|
|
meta_erwinunruh.cpp(76,1): error C2440: 'initializing': cannot convert from 'const int' to 'D<17>' D<i> d = CondNull<pri ? 1 : 0>::value; meta_erwinunruh.cpp(75): note: while compiling class template member function 'void Prime_print<17>::f(void)' |
|
|
|
|
|
|
|
|
expected a string literal |
cppreference wrote: |
---|
Since message has to be a string literal, it cannot contain dynamic information or even a constant expression that is not a string literal itself. In particular, it cannot contain the name of the template type argument. |
static_assert
message prints when the first argument evaluates to false
.main.cpp:58:8: error: no viable conversion from 'const int' to 'D<17>' D<i> d = CondNull<pri ? 1 : 0>::value; // 1 ==> error, 0 ==> succeeds main.cpp:58:8: error: no viable conversion from 'const int' to 'D<13>' D<i> d = CondNull<pri ? 1 : 0>::value; // 1 ==> error, 0 ==> succeeds main.cpp:58:8: error: no viable conversion from 'const int' to 'D<11>' D<i> d = CondNull<pri ? 1 : 0>::value; // 1 ==> error, 0 ==> succeeds main.cpp:58:8: error: no viable conversion from 'const int' to 'D<7>' D<i> d = CondNull<pri ? 1 : 0>::value; // 1 ==> error, 0 ==> succeeds main.cpp:58:8: error: no viable conversion from 'const int' to 'D<5>' D<i> d = CondNull<pri ? 1 : 0>::value; // 1 ==> error, 0 ==> succeeds main.cpp:58:8: error: no viable conversion from 'const int' to 'D<3>' D<i> d = CondNull<pri ? 1 : 0>::value; // 1 ==> error, 0 ==> succeeds main.cpp:58:8: error: no viable conversion from 'const int' to 'D<2>' |