I have this code:
template< char... chars >
struct VariadicTemplate
{};
int
main()
{
VariadicTemplate< "abc"[ 0 ], "abc"[ 1 ], "abc"[ 2 ] > v;
}
This compiles fine with mingw-w64 4.8.1 . However, the same does not compile under MSVC 2013 nor the VC++ November CTP with an error:
Error 1 error C2975: 'chars' : invalid template argument for 'VariadicTamplate', expected compile-time constant expression
Which of the "no"s or "partial"s refer to this? http://blogs.msdn.com/b/vcblog/archive/2013/12/02/c-11-14-core-language-features-in-vs-2013-and-the-nov-2013-ctp.aspx
If none, is this a compiler bug?
This change in behavior from C++03 to C++11 can be located in 5.19 Constant expressions (same clause both standards). As such, I suspect it would be covered by the constexpr no/partial.
Note that the paper given as reference for the constexpr feature, n2235, is where the change to 5.19 was introduced:
4.5.3 Constant expressions revised
Paragraph modification. Replace section 5.19 with [...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With