Example argument specialization template cpprefference.com not working

I found this example at http://en.cppreference.com/w/cpp/language/partial_specialization

template <int I, int J, int K> struct B {};
template <int I> struct B<I, I*2, 2> {};  // OK: first parameter is deducible

I have errors compiling with -std = c ++ 11 and -std = c ++ 14

How to compile this? Or maybe the example is wrong?

error: template argument ‘(I * 2)’ involves template parameter(s)
 template <int I> struct B<I, I*2, 2> {};  // OK: first parameter is deducible
+4
source share
1 answer

, . CWG issue 1315, " ", , @bogdan, . , .

GCC GCC PR 77781.

+6

Source: https://habr.com/ru/post/1668816/


All Articles