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

             Bug #: 12317
           Summary: segmentation fault while compiling template class with
                    inner class and enum
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


Created attachment 8243
  --> http://llvm.org/bugs/attachment.cgi?id=8243
source file

Hi clang developers,

while compiling the following code I get a segfault.

clang_crash.cpp:

template <class A>
class Outer
{
public:
  class Inner
  {
  public:
    //Inner();
    enum {
      VAL1 = 1
    };
    //static const int VAL1=1;

    char b[100-VAL1];
  };

  Inner inner;
};

Outer<int> outer;


/usr> clang++ clang_crash.cpp
clang: error: unable to execute command: Segmentation fault


Some observations:
- removing the enum and uncommenting the "static const int VAL1" makes it work
- uncommenting the Inner() constructor causes about 20 identical errors to be
printed out:

  clang_crash.cpp:8:5: error: constructor cannot be redeclared
      Inner();

Afterwards, clang still segfaults.
- when the outer class isn't a template it also works

I have attached the source, preprocessed source and the run script.

clang version 3.1 (trunk 153100)
Target: x86_64-unknown-linux-gnu
Thread model: posix


Could you have a look please?

Best regards,
Martin

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to