[llvm-bugs] [Bug 42758] New: Assertion failure with fold expression in type-deduced member variable template of variadic class template

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 25 11:36:28 PDT 2019


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

            Bug ID: 42758
           Summary: Assertion failure with fold expression in type-deduced
                    member variable template of variadic class template
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The following translation unit causes an assertion failure on master:

template<bool... xs>
struct s {
        template<typename>
        static inline auto fold = (... and xs);

        void f() {
                fold<int>;
        }
};




With the following error message:


Stack dump:
0.      Program arguments: /opt/wandbox/clang-head/bin/clang-9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name prog.cc
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -nostdinc++
-resource-dir /opt/wandbox/clang-head/lib/clang/9.0.0 -I
/opt/wandbox/clang-head/include/c++/v1 -I /opt/wandbox/boost-sml/include -I
/opt/wandbox/boost-di/include -I /opt/wandbox/range-v3/include -I
/opt/wandbox/nlohmann-json/src -I /opt/wandbox/cmcstl2/include -I
/opt/wandbox/te/include -I /opt/wandbox/boost-1.70.0/clang-head/include
-internal-isystem /usr/local/include -internal-isystem
/opt/wandbox/clang-head/lib/clang/9.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Wall -Wextra -pedantic -std=c++2a
-fdeprecated-macro -fdebug-compilation-dir /home/jail -ferror-limit 19
-fmessage-length 0 -fno-implicit-modules -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -fansi-escape-codes
-faddrsig -o /tmp/prog-512617.o -x c++ prog.cc 
1.      prog.cc:7:12: current parser token ';'
2.      prog.cc:2:1: parsing struct/union/class body 's'
3.      prog.cc:6:11: parsing function body 's::f'
4.      prog.cc:6:11: in compound statement ('{}')
 #0 0x0000000002045464 PrintStackTraceSignalHandler(void*)
(/opt/wandbox/clang-head/bin/clang-9+0x2045464)
 #1 0x00000000020433b0 llvm::sys::RunSignalHandlers()
(/opt/wandbox/clang-head/bin/clang-9+0x20433b0)
 #2 0x0000000002045868 SignalHandler(int)
(/opt/wandbox/clang-head/bin/clang-9+0x2045868)
 #3 0x00007f7137918390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x00000000039b37d7
clang::Sema::BuildExpressionFromIntegralTemplateArgument(clang::TemplateArgument
const&, clang::SourceLocation) (/opt/wandbox/clang-head/bin/clang-9+0x39b37d7)
 #5 0x0000000003a6551a (anonymous
namespace)::TemplateInstantiator::transformNonTypeTemplateParmRef(clang::NonTypeTemplateParmDecl*,
clang::SourceLocation, clang::TemplateArgument)
(/opt/wandbox/clang-head/bin/clang-9+0x3a6551a)
 #6 0x0000000003a64f42 (anonymous
namespace)::TemplateInstantiator::TransformTemplateParmRefExpr(clang::DeclRefExpr*,
clang::NonTypeTemplateParmDecl*)
(/opt/wandbox/clang-head/bin/clang-9+0x3a64f42)
 #7 0x0000000003a59c67 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCXXFoldExpr(clang::CXXFoldExpr*)
(/opt/wandbox/clang-head/bin/clang-9+0x3a59c67)
 #8 0x0000000003a5293d clang::Sema::SubstInitializer(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&, bool)
(/opt/wandbox/clang-head/bin/clang-9+0x3a5293d)
 #9 0x0000000003a8838e
clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*,
clang::MultiLevelTemplateArgumentList const&)
(/opt/wandbox/clang-head/bin/clang-9+0x3a8838e)
#10 0x0000000003a79f0a clang::Sema::BuildVariableInstantiation(clang::VarDecl*,
clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&,
llvm::SmallVector<clang::Sema::LateInstantiatedAttribute, 16u>*,
clang::DeclContext*, clang::LocalInstantiationScope*, bool,
clang::VarTemplateSpecializationDecl*)
(/opt/wandbox/clang-head/bin/clang-9+0x3a79f0a)
#11 0x0000000003a856c0
clang::TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(clang::VarTemplateDecl*,
clang::VarDecl*, void*, clang::TemplateArgumentListInfo const&,
llvm::ArrayRef<clang::TemplateArgument>, clang::VarTemplateSpecializationDecl*)
(/opt/wandbox/clang-head/bin/clang-9+0x3a856c0)
#12 0x0000000003a88128
clang::Sema::BuildVarTemplateInstantiation(clang::VarTemplateDecl*,
clang::VarDecl*, clang::TemplateArgumentList const&,
clang::TemplateArgumentListInfo const&,
llvm::SmallVectorImpl<clang::TemplateArgument>&, clang::SourceLocation, void*,
llvm::SmallVector<clang::Sema::LateInstantiatedAttribute, 16u>*,
clang::LocalInstantiationScope*)
(/opt/wandbox/clang-head/bin/clang-9+0x3a88128)
#13 0x00000000039aab82 clang::Sema::CheckVarTemplateId(clang::VarTemplateDecl*,
clang::SourceLocation, clang::SourceLocation, clang::TemplateArgumentListInfo
const&) (/opt/wandbox/clang-head/bin/clang-9+0x39aab82)
#14 0x00000000039aba48 clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec
const&, clang::SourceLocation, clang::LookupResult&, bool,
clang::TemplateArgumentListInfo const*)
(/opt/wandbox/clang-head/bin/clang-9+0x39aba48)
#15 0x000000000380e73d
clang::Sema::BuildPossibleImplicitMemberExpr(clang::CXXScopeSpec const&,
clang::SourceLocation, clang::LookupResult&, clang::TemplateArgumentListInfo
const*, clang::Scope const*) (/opt/wandbox/clang-head/bin/clang-9+0x380e73d)
#16 0x00000000037396fd clang::Sema::ActOnIdExpression(clang::Scope*,
clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
clang::CorrectionCandidateCallback*, bool, clang::Token*)
(/opt/wandbox/clang-head/bin/clang-9+0x37396fd)
#17 0x000000000341f1dc
clang::Parser::tryParseCXXIdExpression(clang::CXXScopeSpec&, bool,
clang::Token&) (/opt/wandbox/clang-head/bin/clang-9+0x341f1dc)
#18 0x000000000342021a clang::Parser::ParseCXXIdExpression(bool)
(/opt/wandbox/clang-head/bin/clang-9+0x342021a)
#19 0x00000000034119cd clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState, bool)
(/opt/wandbox/clang-head/bin/clang-9+0x34119cd)
#20 0x000000000340d1fc
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/opt/wandbox/clang-head/bin/clang-9+0x340d1fc)
#21 0x000000000340d109
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/opt/wandbox/clang-head/bin/clang-9+0x340d109)
#22 0x0000000003456697
clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
(/opt/wandbox/clang-head/bin/clang-9+0x3456697)
#23 0x0000000003455066
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/opt/wandbox/clang-head/bin/clang-9+0x3455066)
#24 0x0000000003454adf
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/opt/wandbox/clang-head/bin/clang-9+0x3454adf)
#25 0x000000000345c14e clang::Parser::ParseCompoundStatementBody(bool)
(/opt/wandbox/clang-head/bin/clang-9+0x345c14e)
#26 0x000000000345ccb9 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/opt/wandbox/clang-head/bin/clang-9+0x345ccb9)
#27 0x00000000033d9538
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&)
(/opt/wandbox/clang-head/bin/clang-9+0x33d9538)
#28 0x00000000033d85ae
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&)
(/opt/wandbox/clang-head/bin/clang-9+0x33d85ae)
#29 0x000000000340311a
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/opt/wandbox/clang-head/bin/clang-9+0x340311a)
#30 0x0000000003400c43
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/opt/wandbox/clang-head/bin/clang-9+0x3400c43)
#31 0x00000000033e4045
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/opt/wandbox/clang-head/bin/clang-9+0x33e4045)
#32 0x00000000034636b9
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/wandbox/clang-head/bin/clang-9+0x34636b9)
#33 0x00000000034630c5
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/wandbox/clang-head/bin/clang-9+0x34630c5)
#34 0x0000000003462b05
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/wandbox/clang-head/bin/clang-9+0x3462b05)
#35 0x00000000033e362e
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/opt/wandbox/clang-head/bin/clang-9+0x33e362e)
#36 0x00000000033ce9af
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/opt/wandbox/clang-head/bin/clang-9+0x33ce9af)
#37 0x00000000033cccd7
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/opt/wandbox/clang-head/bin/clang-9+0x33cccd7)
#38 0x00000000033cc786
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/opt/wandbox/clang-head/bin/clang-9+0x33cc786)
#39 0x00000000033c8897 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/wandbox/clang-head/bin/clang-9+0x33c8897)
#40 0x000000000265c898 clang::FrontendAction::Execute()
(/opt/wandbox/clang-head/bin/clang-9+0x265c898)
#41 0x000000000261661f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/wandbox/clang-head/bin/clang-9+0x261661f)
#42 0x000000000270fbe3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/wandbox/clang-head/bin/clang-9+0x270fbe3)
#43 0x0000000000938084 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/wandbox/clang-head/bin/clang-9+0x938084)
#44 0x0000000000936910 main (/opt/wandbox/clang-head/bin/clang-9+0x936910)
#45 0x00007f7136687830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#46 0x0000000000933c29 _start (/opt/wandbox/clang-head/bin/clang-9+0x933c29)
clang-9: error: unable to execute command: Segmentation fault
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (https://github.com/llvm-mirror/clang.git
6ed0749151866894a67a3e7eefdc1f3a547daa0e)
(https://github.com/llvm-mirror/llvm.git
a10a70238ace1093cad3adeb94814b422bd1b5c1)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-9: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/prog-1328c9.cpp
clang-9: note: diagnostic msg: /tmp/prog-1328c9.sh
clang-9: 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/20190725/5fa2fa06/attachment-0001.html>


More information about the llvm-bugs mailing list