[llvm-bugs] [Bug 44672] New: Assertion failure with unexpanded variadic pack in concept definition

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jan 26 12:08:14 PST 2020


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

            Bug ID: 44672
           Summary: Assertion failure with unexpanded variadic pack in
                    concept definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          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 ill-formed code:

```
template<typename>
int c = 1;

template<typename... Ts>
concept c_wrapper = c<Ts>;

static_assert(c_wrapper<int>);
```

causes clang to crash with

```
clang++: /home/david/llvm/clang/lib/AST/ExprConstant.cpp:13755: bool
clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult &, const
clang::ASTContext &, bool) const: Assertion `!isValueDependent() && "Expression
evaluator can't be called on a dependent expression."' failed.

Stack dump:

0.      Program arguments: /home/david/llvm/build/bin/clang++ -g -o
/tmp/compiler-explorer-compiler120026-63259-279ley.8vya3/output.s -mllvm
--x86-asm-syntax=intel -S -std=c++2a -fcolor-diagnostics -fno-crash-diagnostics
<source> 

1.      <source>:7:29: current parser token ')'

 #0 0x000055b246c107e2 PrintStackTraceSignalHandler(void*)
(/home/david/llvm/build/bin/clang+++0x31f27e2)

 #1 0x000055b246c0e14e llvm::sys::RunSignalHandlers()
(/home/david/llvm/build/bin/clang+++0x31f014e)

 #2 0x000055b246c0f867 llvm::sys::CleanupOnSignal(unsigned long)
(/home/david/llvm/build/bin/clang+++0x31f1867)

 #3 0x000055b246b8aa5e (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
(/home/david/llvm/build/bin/clang+++0x316ca5e)

 #4 0x000055b246b8ac04 CrashRecoverySignalHandler(int)
(/home/david/llvm/build/bin/clang+++0x316cc04)

 #5 0x00007f0ce1b19930 __restore_rt (/usr/lib/libpthread.so.0+0x14930)

 #6 0x00007f0ce1594f25 raise (/usr/lib/libc.so.6+0x3bf25)

 #7 0x00007f0ce157e897 abort (/usr/lib/libc.so.6+0x25897)

 #8 0x00007f0ce157e767 _nl_load_domain.cold (/usr/lib/libc.so.6+0x25767)

 #9 0x00007f0ce158d526 (/usr/lib/libc.so.6+0x34526)

#10 0x000055b249357c27 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&,
clang::ASTContext const&, bool) const
(/home/david/llvm/build/bin/clang+++0x5939c27)

#11 0x000055b2489720f5 bool
calculateConstraintSatisfaction<calculateConstraintSatisfaction(clang::Sema&,
clang::NamedDecl const*, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceLocation, clang::MultiLevelTemplateArgumentList&, clang::Expr
const*, clang::ConstraintSatisfaction&)::$_5>(clang::Sema&, clang::Expr const*,
clang::ConstraintSatisfaction&, calculateConstraintSatisfaction(clang::Sema&,
clang::NamedDecl const*, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceLocation, clang::MultiLevelTemplateArgumentList&, clang::Expr
const*, clang::ConstraintSatisfaction&)::$_5&&)
(/home/david/llvm/build/bin/clang+++0x4f540f5)

#12 0x000055b24896cd6a
clang::Sema::CheckConstraintSatisfaction(clang::NamedDecl const*,
llvm::ArrayRef<clang::Expr const*>, llvm::ArrayRef<clang::TemplateArgument>,
clang::SourceRange, clang::ConstraintSatisfaction&)
(/home/david/llvm/build/bin/clang+++0x4f4ed6a)

#13 0x000055b248ebea9a clang::Sema::CheckConceptTemplateId(clang::CXXScopeSpec
const&, clang::SourceLocation, clang::DeclarationNameInfo const&,
clang::NamedDecl*, clang::ConceptDecl*, clang::TemplateArgumentListInfo const*)
(/home/david/llvm/build/bin/clang+++0x54a0a9a)

#14 0x000055b248ebed6c clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec
const&, clang::SourceLocation, clang::LookupResult&, bool,
clang::TemplateArgumentListInfo const*)
(/home/david/llvm/build/bin/clang+++0x54a0d6c)

#15 0x000055b248b84a6e clang::Sema::ActOnIdExpression(clang::Scope*,
clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
clang::CorrectionCandidateCallback*, bool, clang::Token*)
(/home/david/llvm/build/bin/clang+++0x5166a6e)

#16 0x000055b2487b8894
clang::Parser::tryParseCXXIdExpression(clang::CXXScopeSpec&, bool,
clang::Token&) (/home/david/llvm/build/bin/clang+++0x4d9a894)

#17 0x000055b2487b9c6c clang::Parser::ParseCXXIdExpression(bool)
(/home/david/llvm/build/bin/clang+++0x4d9bc6c)

#18 0x000055b2487cb17d
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/home/david/llvm/build/bin/clang+++0x4dad17d)

#19 0x000055b2487cbec7
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/home/david/llvm/build/bin/clang+++0x4dadec7)

#20 0x000055b2487c9513
clang::Parser::ParseConstantExpressionInExprEvalContext(clang::Parser::TypeCastState)
(/home/david/llvm/build/bin/clang+++0x4dab513)

#21 0x000055b248779a5a
clang::Parser::ParseStaticAssertDeclaration(clang::SourceLocation&)
(/home/david/llvm/build/bin/clang+++0x4d5ba5a)

#22 0x000055b248797554
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*) (/home/david/llvm/build/bin/clang+++0x4d79554)

#23 0x000055b24876b5cf
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/home/david/llvm/build/bin/clang+++0x4d4d5cf)

#24 0x000055b248769d37
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/david/llvm/build/bin/clang+++0x4d4bd37)

#25 0x000055b248764f6d clang::ParseAST(clang::Sema&, bool, bool)
(/home/david/llvm/build/bin/clang+++0x4d46f6d)

#26 0x000055b24764a594 clang::CodeGenAction::ExecuteAction()
(/home/david/llvm/build/bin/clang+++0x3c2c594)

#27 0x000055b24758a9c6 clang::FrontendAction::Execute()
(/home/david/llvm/build/bin/clang+++0x3b6c9c6)

#28 0x000055b2474dd7f3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/david/llvm/build/bin/clang+++0x3abf7f3)

#29 0x000055b247645078
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/david/llvm/build/bin/clang+++0x3c27078)

#30 0x000055b245b594ff cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/david/llvm/build/bin/clang+++0x213b4ff)

#31 0x000055b245b5748d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/david/llvm/build/bin/clang+++0x213948d)

#32 0x000055b24738f532 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long)
(/home/david/llvm/build/bin/clang+++0x3971532)

#33 0x000055b246b8a9aa
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/david/llvm/build/bin/clang+++0x316c9aa)

#34 0x000055b24738e995
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/home/david/llvm/build/bin/clang+++0x3970995)

#35 0x000055b24735922b
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/david/llvm/build/bin/clang+++0x393b22b)

#36 0x000055b24735967a
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/david/llvm/build/bin/clang+++0x393b67a)

#37 0x000055b247371c17
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/david/llvm/build/bin/clang+++0x3953c17)

#38 0x000055b245b56bf7 main (/home/david/llvm/build/bin/clang+++0x2138bf7)

#39 0x00007f0ce1580153 __libc_start_main (/usr/lib/libc.so.6+0x27153)

#40 0x000055b245b5402e _start (/home/david/llvm/build/bin/clang+++0x213602e)

clang++: /home/david/llvm/clang/lib/Parse/Parser.cpp:444: virtual
clang::Parser::~Parser(): Assertion `TemplateIds.empty() && "Still alive
TemplateIdAnnotations around?"' failed.

Compiler returned: -1
```

-- 
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/20200126/34b26787/attachment.html>


More information about the llvm-bugs mailing list