https://bugs.llvm.org/show_bug.cgi?id=38205

            Bug ID: 38205
           Summary: type mismatch in explicit template instantiate not
                    detected
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follow:

template<class T>
class A
{
 static T a;
};

template<class T>
T A<T>::a;

class B
{ };

template
int A<B>::a; // type mismatch

clang++ accepts the code. The code should produce an error for the explicit
template instantiation, because the type given for the static variable
doesn't match the one in the class template. Please note that g++ rejects the
code:

error: type 'B' for explicit instantiation 'A<B>::a' does not match declared
type 'int'
 int A<B>::a; // type mismatch

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to