[LLVMbugs] [Bug 13989] New: Assertion "Unexpected kind" with template default parameter, constructor and -gdwarf-2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 2 03:30:26 PDT 2012


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

             Bug #: 13989
           Summary: Assertion "Unexpected kind" with template default
                    parameter, constructor and -gdwarf-2
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9284
  --> http://llvm.org/bugs/attachment.cgi?id=9284
Complete log of clang run

The following program crashes clang r164992 when being compiled with -gdwarf-2:

template <typename T>
struct Vector {
    template <typename U, void* = nullptr>
    Vector(U);
};

struct Foo {
    Foo();

    Vector<float>   v;
};

Foo::Foo() :
    v(1)
{
}


This results in (complete log attached):

% /Users/rynnsauer/LLVM/build/Release+Asserts/bin/clang -gdwarf-2 -std=c++0x
clang.cpp
Assertion failed: (Kind == Template && "Unexpected kind"), function
getAsTemplate, file
/Users/rynnsauer/LLVM/llvm/tools/clang/lib/AST/../../include/clang/AST/TemplateBase.h,
line 249.


The problem seems to be the template default parameter of Vector's constructor:
When removing it, the code compiles. The code also compiles when Foo's
constructor is declared to be "inline".

The crash did not happen with clang r164482.

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