Consider the following:
template<class T>
struct A
{
struct B
{} static const b;
};
// case 1
template<class T>
typename A<T>::B const A<T>::b;
// case 2
template<class T>
typename A<T>::B const A<T>::b{};
int main()
{
A<int> a;
a.b;
return 0;
}
case1:
gcc 5.2 passes
msvc 2015 update 1 passes
clang 3.7 error:
default initialization of an object of const type 'const typename A<int>::B' without a user-provided default constructor
case2:
gcc 5.2 passes
clang 3.7 passes:
msvc 2015 update 1 error:
error C2143: syntax error: missing ';' before '<end Parse>'
Which compiler is right / wrong in each case?
Aucun commentaire:
Enregistrer un commentaire