[LLVMbugs] [Bug 12524] New: Structure not a POD within a template class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 11 06:46:40 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12524

             Bug #: 12524
           Summary: Structure not a POD within a template class
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: gus at marcais.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following simple program creates a variable length array of structures:

//template<typename T>
class Test {
public:
 struct toto {
   int* x;
 };

 void method(int nb) {
   toto ary[nb];
   for(int i = 0; i < nb; ++i)
     ary[i].x = 0;
 }
};


int main(int argc, char* argv[]) {
 //Test<char> t;
 Test t;
 t.method(5);

 return 0;
}

In compiles properly as written with clang++ version 3.0. When
uncommeting the templated version, then the compiler complains:

POD.cc:9:13: error: variable length array of non-POD element type
'Test<char>::toto'
   toto ary[nb];

The structure toto is still a POD in the templated class and this code should
compile without error.

-- 
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