llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Assertion `(Encoding == dwarf::DW_ATE_unsigned || ... ' with nullptr

Open wolfy1961 opened this issue 11 years ago • 2 comments

Bugzilla Link 21875
Resolution FIXED
Resolved on Dec 16, 2014 18:44
Version trunk
OS Linux
CC @dwblaikie,@echristo

Extended Description

// The following source gets an assertion at // lib/CodeGen/AsmPrinter/DwarfUnit.cpp:783 with // clang -cc1 -g -triple x86_64-unknown-linux-gnu -emit-obj -std=c++11:

template<class T, T t> void f() {} typedef decltype(nullptr) nullptr_t; template <> void f<nullptr_t, nullptr>() {}

/* llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:783: bool isUnsignedDIType(llvm::DwarfDebug*, llvm::DIType): Assertion `(Encoding == dwarf::DW_ATE_unsigned || Encoding == dwarf::DW_ATE_unsigned_char || Encoding == dwarf::DW_ATE_signed || Encoding == dwarf::DW_ATE_signed_char || Encoding == dwarf::DW_ATE_UTF || Encoding == dwarf::DW_ATE_boolean) && "Unsupported encoding"' failed. */

wolfy1961 avatar Dec 11 '14 03:12 wolfy1961

GCC produced a DW_TAG_template_value_parameter with const_value of data1 0. udata 0 seems appropriate (as we do for null valued pointer typed non-type template parameters), so I implemented that in r224399.

dwblaikie avatar Dec 17 '14 02:12 dwblaikie

Interesting. I'm pretty sure that we shouldn't be adding the nullptr as a constant of value 0 when creating the template parameter.

echristo avatar Dec 11 '14 22:12 echristo