Language
C++
Compiler
gcc 11.1.0
Options
Warnings
Boost 1.76.0
C++11
no pedantic
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.76.0/gcc-11.1.0/include -std=c++11
primary template
choosen for A
Exit Code:
0
Author
anonymous
over 3 years ago
C++
gcc 11.1.0
Author
anonymous
over 3 years ago
$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.76.0/gcc-11.1.0/include -std=c++11
prog.cc: In instantiation of 'void func(const T&) [with T = int; int v = 9]':
prog.cc:21:17: required from here
prog.cc:9:48: warning: unused parameter 'x' [-Wunused-parameter]
9 | template <typename T, int v> void func(const T&x) //primary template
| ~~~~~~~~^
prog.cc: In instantiation of 'void func(const A&) [with T = A; int v = 9; <template-parameter-1-3> = std::enable_if<true, void>]':
prog.cc:22:15: required from here
prog.cc:14:101: warning: unused parameter 'x' [-Wunused-parameter]
14 | template <typename T,int v, typename = std::enable_if<std::is_same<T, A>::value>> void func(const A&x)
| ~~~~~~~~^
primary template
choosen for A