[LLVMbugs] [Bug 8292] New: Clang does not sufficiently check completely defined-ness of class template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 4 06:36:17 PDT 2010


           Summary: Clang does not sufficiently check completely
                    defined-ness of class template
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub-johannes at web.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

This template definition is rejected by comeau and GCC but not really by Clang

template <class T>
struct A
  struct B { };

  void f() { }

  struct C {
    int c[sizeof(A<int>::B)];

  void g() { }

int main() {
  A<int> b;

Clang does accept all the code up to until "b.g()" complaining that "g" was not

main1.cpp:18:5: error: no member named 'g' in 'A<int>'

It appears to me that it causes an implicit instantiation of A<int> at
"sizeof(A<int>::B)" and instantiates declarations of A<int> for up to until
A::C, ignoring any data and function members declared past A::C. 

I think this example is ill-formed already at "sizeof(A<int>::B)" by
[temp.inst]p6 "If an implicit instantiation of a class template specialization
is required and the template is declared but not defined, the program is

This also makes the second example of PR7308 which writes "friend
A<int>::operator A<double>();" ill-formed.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list