[llvm-bugs] [Bug 36728] New: Assertion failed: (!ParamType.hasQualifiers() && "non-type template parameter type cannot be qualified")

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 14 07:07:50 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=36728

            Bug ID: 36728
           Summary: Assertion failed: (!ParamType.hasQualifiers() &&
                    "non-type template parameter type cannot be
                    qualified")
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brenton at wolfram.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

This triggers an assert in clang:


template <typename T, T const data[]>
struct helper {
  static constexpr T value = helper<T, data>::value * data;
};






Assertion failed: (!ParamType.hasQualifiers() && "non-type template parameter
type cannot be qualified"), function CheckTemplateArgument, file
/Users/brenton/llvm-development/llvm60/llvm/tools/clang/lib/Sema/SemaTemplate.cpp,
line 6023.
0  libLLVM.dylib            0x0000000119c2558c
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1  libLLVM.dylib            0x0000000119c25b59
PrintStackTraceSignalHandler(void*) + 25
2  libLLVM.dylib            0x0000000119c21619 llvm::sys::RunSignalHandlers() +
425
3  libLLVM.dylib            0x0000000119c25ed2 SignalHandler(int) + 354
4  libsystem_platform.dylib 0x00007fffc8f89b3a _sigtramp + 26
5  clang-6.0                0x00000001097a06aa
clang::ConcreteTypeLoc<clang::UnqualTypeLoc, clang::TypeSpecTypeLoc,
clang::Type, clang::TypeSpecLocInfo>::getNextTypeLoc() const + 42
6  libsystem_c.dylib        0x00007fffc8e0e420 abort + 129
7  libsystem_c.dylib        0x00007fffc8dd5893 basename_r + 0
8  clang-6.0                0x000000010859da0a
clang::Sema::CheckTemplateArgument(clang::NonTypeTemplateParmDecl*,
clang::QualType, clang::Expr*, clang::TemplateArgument&,
clang::Sema::CheckTemplateArgumentKind) + 1210
9  clang-6.0                0x00000001085b3efa
clang::Sema::CheckTemplateArgument(clang::NamedDecl*,
clang::TemplateArgumentLoc&, clang::NamedDecl*, clang::SourceLocation,
clang::SourceLocation, unsigned int,
llvm::SmallVectorImpl<clang::TemplateArgument>&,
clang::Sema::CheckTemplateArgumentKind) + 1274
10 clang-6.0                0x00000001085a9c94
clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*,
clang::SourceLocation, clang::TemplateArgumentListInfo&, bool,
llvm::SmallVectorImpl<clang::TemplateArgument>&, bool) + 1316
11 clang-6.0                0x00000001085a8051
clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation,
clang::TemplateArgumentListInfo&) + 737
12 clang-6.0                0x0000000107c4769f
clang::Sema::ActOnCXXNestedNameSpecifier(clang::Scope*, clang::CXXScopeSpec&,
clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>,
clang::SourceLocation, clang::SourceLocation,
llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation,
clang::SourceLocation, bool) + 1839
13 clang-6.0                0x000000010779c772
clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&,
clang::OpaquePtr<clang::QualType>, bool, bool*, bool, clang::IdentifierInfo**,
bool) + 3954
14 clang-6.0                0x0000000107829662
clang::Parser::TryAnnotateTypeOrScopeToken() + 2610
15 clang-6.0                0x000000010778ca46
clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState, bool) + 14582
16 clang-6.0                0x0000000107786975
clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState,
bool) + 101
17 clang-6.0                0x0000000107784df3
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 243
18 clang-6.0                0x0000000107769510
clang::Parser::ParseInitializer() + 64
19 clang-6.0                0x00000001077693a5
clang::Parser::ParseCXXMemberInitializer(clang::Decl*, bool,
clang::SourceLocation&) + 853
20 clang-6.0                0x0000000107767ff4
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*) + 7652
21 clang-6.0                0x0000000107769d95
clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&,
clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType,
clang::Decl*) + 2021
22 clang-6.0                0x000000010776358a
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 4042
23 clang-6.0                0x0000000107760d34
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 12036
24 clang-6.0                0x000000010773b6bd
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 13789
25 clang-6.0                0x000000010780d940
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 880
26 clang-6.0                0x000000010780d318
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1544
27 clang-6.0                0x000000010780cbbe
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 238
28 clang-6.0                0x000000010773790f
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 255
29 clang-6.0                0x00000001078224a2
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2626
30 clang-6.0                0x0000000107821406
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 1126
31 clang-6.0                0x0000000107820f2e
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) +
46
32 clang-6.0                0x0000000107720658 clang::ParseAST(clang::Sema&,
bool, bool) + 760
33 clang-6.0                0x0000000106aa0125
clang::ASTFrontendAction::ExecuteAction() + 485
34 clang-6.0                0x0000000106a9f080 clang::FrontendAction::Execute()
+ 112
35 clang-6.0                0x000000010699b32d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 2285
36 clang-6.0                0x0000000106b63e33
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 5843
37 clang-6.0                0x0000000105d11af4 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 4900
38 clang-6.0                0x0000000105d0068e
ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) + 622
39 clang-6.0                0x0000000105cfdd2a main + 4282
40 libdyld.dylib            0x00007fffc8d7a235 start + 1
41 libdyld.dylib            0x0000000000000033 start + 925392383
Stack dump:
0.      Program arguments:
/Users/brenton/llvm-development/llvm60/build/bin/clang-6.0 -cc1 -triple
x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage
-Werror=deprecated-objc-isa-usage -emit-pch -disable-free -main-file-name
mpl.hpp -mrelocation-model pic -pic-level 2 -mthread-model posix
-mdisable-fp-elim -masm-verbose -munwind-tables -faligned-alloc-unavailable
-target-cpu penryn -dwarf-column-info -debugger-tuning=lldb
-target-linker-version 305 -resource-dir
/Users/brenton/llvm-development/llvm60/build/lib/clang/6.0.0 -stdlib=libc++
-fdeprecated-macro -fdebug-compilation-dir
/Users/brenton/development/projects/clang-crash -ferror-limit 19
-fmessage-length 192 -stack-protector 1 -fblocks
-fencode-extended-block-signature -fobjc-runtime=macosx-10.12.0
-fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option
-fcolor-diagnostics -o mpl.hpp.gch -x c++-header mpl.hpp 
1.      mpl.hpp:4:47: current parser token 'value'
2.      mpl.hpp:3:1: parsing struct/union/class body 'helper'
clang-6.0: error: unable to execute command: Abort trap: 6
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (tags/RELEASE_600/final 326708)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Users/brenton/llvm-development/llvm60/build/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-6.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6.0: note: diagnostic msg:
/var/folders/bz/271lmnjx223cvr83c11lw8vc000bfy/T/mpl-da9f6f.hh
clang-6.0: note: diagnostic msg:
/var/folders/bz/271lmnjx223cvr83c11lw8vc000bfy/T/mpl-da9f6f.sh
clang-6.0: note: diagnostic msg: Crash backtrace is located in
clang-6.0: note: diagnostic msg:
/Users/brenton/Library/Logs/DiagnosticReports/clang-6.0_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang-6.0: note: diagnostic msg: (choose the .crash file that corresponds to
your crash)
clang-6.0: note: diagnostic msg: 

********************

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180314/6e53c7a6/attachment-0001.html>


More information about the llvm-bugs mailing list