[LLVMbugs] [Bug 23451] New: Segfault with generic lambda and a decltype(undefined_variable) return type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 7 16:48:54 PDT 2015


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

            Bug ID: 23451
           Summary: Segfault with generic lambda and a
                    decltype(undefined_variable) return type
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

main.cpp:

using T = decltype([](auto && t) -> decltype(x) { return t; }(0));



david at i5-fedora ~/test> clang++ source/main.cpp -std=c++14 -c
source/main.cpp:1:46: error: use of undeclared identifier 'x'
using T = decltype([](auto && t) -> decltype(x) { return t; }(0));
                                             ^
0  clang           0x000000000203c7c5 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x000000000203cf33
2  libpthread.so.0 0x00000032bec0efa0
3  clang           0x00000000013f09f1 clang::ParmVarDecl::isParameterPack()
const + 1
4  clang           0x0000000000e70bf6
clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*,
llvm::SmallVectorImpl<clang::ParmVarDecl*>&) + 918
5  clang           0x0000000000e6e4e0
clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*,
clang::TemplateParameterList*, bool) + 752
6  clang           0x0000000000e71398 clang::Sema::SubstDecl(clang::Decl*,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 136
7  clang           0x0000000000e0d0b8
clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&,
llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*) + 1976
8  clang           0x0000000000e0f1ca
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&) + 3306
9  clang           0x0000000000d67caf
clang::Sema::AddMethodTemplateCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::CXXRecordDecl*, clang::TemplateArgumentListInfo*,
clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool) + 319
10 clang           0x0000000000d680da
clang::Sema::AddMethodCandidate(clang::DeclAccessPair, clang::QualType,
clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool) + 202
11 clang           0x0000000000d7d348
clang::Sema::BuildCallToObjectOfClassType(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation) + 1256
12 clang           0x0000000000c40e6f clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool) + 2303
13 clang           0x0000000000a50176
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 2742
14 clang           0x0000000000a52c35 clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 8165
15 clang           0x0000000000a4e40d
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 125
16 clang           0x0000000000a4e379
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
17 clang           0x0000000000a3fd21
clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&) + 737
18 clang           0x0000000000a5ab89
clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&,
clang::OpaquePtr<clang::QualType>, bool, bool*, bool, clang::IdentifierInfo**)
+ 777
19 clang           0x0000000000a1bc56
clang::Parser::TryAnnotateCXXScopeToken(bool) + 230
20 clang           0x0000000000a26faf
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 399
21 clang           0x0000000000a1dfc2
clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&,
clang::AccessSpecifier, clang::Parser::DeclSpecContext) + 66
22 clang           0x0000000000a1dc43
clang::Parser::ParseTypeName(clang::SourceRange*,
clang::Declarator::TheContext, clang::AccessSpecifier, clang::Decl**,
clang::ParsedAttributes*) + 307
23 clang           0x0000000000a3ebff
clang::Parser::ParseUsingDeclaration(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation,
clang::SourceLocation&, clang::AccessSpecifier, clang::Decl**) + 4111
24 clang           0x0000000000a3d858
clang::Parser::ParseUsingDirectiveOrDeclaration(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&, clang::Decl**) + 792
25 clang           0x0000000000a26962
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 754
26 clang           0x0000000000a17171
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2241
27 clang           0x0000000000a167e4
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 484
28 clang           0x0000000000a1276a clang::ParseAST(clang::Sema&, bool, bool)
+ 266
29 clang           0x00000000008427c7 clang::CodeGenAction::ExecuteAction() +
631
30 clang           0x000000000067c3ce clang::FrontendAction::Execute() + 62
31 clang           0x0000000000655363
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 851
32 clang           0x0000000000639fec
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2940
33 clang           0x0000000000631296 cc1_main(char const**, char const**, char
const*, void*) + 534
34 clang           0x0000000000637be5 main + 9669
35 libc.so.6       0x00000032be421b45 __libc_start_main + 245
36 clang           0x0000000000630fb1
Stack dump:
0.    Program arguments: /home/david/llvm-3.5.0/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
main.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.23.52.0.1 -dwarf-column-info -coverage-file
/home/david/test/main.o -resource-dir
/home/david/llvm-3.5.0/bin/../lib/clang/3.5.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3
-internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/x86_64-redhat-linux
-internal-isystem
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/backward
-internal-isystem /usr/local/include -internal-isystem
/home/david/llvm-3.5.0/bin/../lib/clang/3.5.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro
-fdebug-compilation-dir /home/david/test -ferror-limit 19 -fmessage-length 104
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -o main.o -x c++ source/main.cpp 
1.    source/main.cpp:1:64: current parser token ')'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: 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: 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/20150507/e61965f4/attachment.html>


More information about the llvm-bugs mailing list