[LLVMbugs] [Bug 23853] New: Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"' failed -- in instantiation of struct inside lambda inside template struct

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 15 14:03:30 PDT 2015


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

            Bug ID: 23853
           Summary: Assertion `isa<LabelDecl>(D) && "declaration not
                    instantiated in this scope"' failed -- in
                    instantiation of struct inside lambda inside template
                    struct
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.vul at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

We have a template class containing a lambda which itself contains an inner
class.
Both inner structures -- the lambda and its inner class -- depdend on the
template parameter of the outer class.
Instantiation of this gives the assertion failure in the summary.

### SOURCE: cat t.cc
template <class R> struct S {
    S(R x1) {
        [] (R x2) -> void {
            struct A {
                R x3;
                A(R x4) : x3(x4) {}
            };
            A a(x2);
        }(x1);
    }
};
S<int> t (0);

int main() { } 

## INVOCATION: clang++ -v -std=c++11 -c t.cc
clang version 3.6.1 (tags/RELEASE_361/final)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.9.1
Selected GCC installation: /usr/lib/gcc/powerpc64le-linux-gnu/4.9
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/gsa/tlbgsa-h1/09/andreyv/clang/bin/clang-3.6" -cc1 -triple
powerpc64le-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name t.cc -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-fuse-init-array -target-cpu ppc64le -target-abi elfv2 -v -dwarf-column-info
-coverage-file /tmp/t.cc -resource-dir
/gsa/tlbgsa-h1/09/andreyv/clang/bin/../lib/clang/3.6.1 -internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/c++/4.9
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/powerpc64le-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/powerpc64le-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/gsa/tlbgsa-h1/09/andreyv/clang/bin/../lib/clang/3.6.1/include
-internal-externc-isystem /usr/include/powerpc64le-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 135 -mstackrealign -fno-signed-char -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
t.o -x c++ t.cc
clang -cc1 version 3.6.1 based upon LLVM 3.6.1 default target
powerpc64le-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory
"/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/powerpc64le-linux-gnu/c++/4.9"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/c++/4.9

/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/powerpc64le-linux-gnu/c++/4.9
 /usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/c++/4.9/backward
 /usr/local/include
 /gsa/tlbgsa-h1/09/andreyv/clang/bin/../lib/clang/3.6.1/include
 /usr/include/powerpc64le-linux-gnu
 /usr/include
End of search list.
clang-3.6:
/scratch/andreyv/llvm-3.6.1.src/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp:2818:
llvm::PointerUnion<clang::Decl*, llvm::SmallVector<clang::Decl*, 4u>*>*
clang::LocalInstantiationScope::findInstantiationOf(const clang::Decl*):
Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"'
failed.
#0 0x12703d14 llvm::sys::PrintStackTrace(_IO_FILE*)
/scratch/andreyv/llvm-3.6.1.src/lib/Support/Unix/Signals.inc:423:0
#1 0x12704090 PrintStackTraceSignalHandler(void*)
/scratch/andreyv/llvm-3.6.1.src/lib/Support/Unix/Signals.inc:480:0
#2 0x127027b0 SignalHandler(int)
/scratch/andreyv/llvm-3.6.1.src/lib/Support/Unix/Signals.inc:199:0
0  clang-3.6 0x0000000012703d14 llvm::sys::PrintStackTrace(_IO_FILE*) + 68
1  clang-3.6 0x0000000012704090
2  clang-3.6 0x00000000127027b0
3            0x00003fffa5a80478 __kernel_sigtramp_rt64 + 0
4  libc.so.6 0x00003fffa55d06b8 gsignal + 72
5  libc.so.6 0x00003fffa55d295c abort + 636
6  libc.so.6 0x00003fffa55c6274
7  libc.so.6 0x00003fffa55c6364 __assert_fail + 100
8  clang-3.6 0x000000001475abc4
clang::LocalInstantiationScope::findInstantiationOf(clang::Decl const*) + 500
9  clang-3.6 0x00000000147ae6d4
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 492
10 clang-3.6 0x00000000147ae4a8
clang::Sema::FindInstantiatedContext(clang::SourceLocation,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 88
11 clang-3.6 0x00000000147aec20
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 1848
12 clang-3.6 0x00000000147ad578
clang::Sema::InstantiateMemInitializers(clang::CXXConstructorDecl*,
clang::CXXConstructorDecl const*, clang::MultiLevelTemplateArgumentList const&)
+ 1676
13 clang-3.6 0x00000000147aadf8
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2536
14 clang-3.6 0x00000000147af394 clang::Sema::PerformPendingInstantiations(bool)
+ 364
15 clang-3.6 0x00000000147aafa4
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2964
16 clang-3.6 0x00000000147af394 clang::Sema::PerformPendingInstantiations(bool)
+ 364
17 clang-3.6 0x0000000014078e80 clang::Sema::ActOnEndOfTranslationUnit() + 788
18 clang-3.6 0x0000000013da174c
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 548
19 clang-3.6 0x0000000013d96a8c clang::ParseAST(clang::Sema&, bool, bool) + 692
20 clang-3.6 0x00000000129d96f0 clang::ASTFrontendAction::ExecuteAction() + 468
21 clang-3.6 0x0000000012e95858 clang::CodeGenAction::ExecuteAction() + 1388
22 clang-3.6 0x00000000129d8ff8 clang::FrontendAction::Execute() + 188
23 clang-3.6 0x0000000012986600
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1044
24 clang-3.6 0x0000000012ba8b5c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1316
25 clang-3.6 0x0000000010db9038 cc1_main(llvm::ArrayRef<char const*>, char
const*, void*) + 876
26 clang-3.6 0x0000000010daac88
27 clang-3.6 0x0000000010dab3d4 main + 1040
28 libc.so.6 0x00003fffa55b4e80
29 libc.so.6 0x00003fffa55b5074 __libc_start_main + 196
Stack dump:
0.    Program arguments: /gsa/tlbgsa-h1/09/andreyv/clang/bin/clang-3.6 -cc1
-triple powerpc64le-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name t.cc -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-fuse-init-array -target-cpu ppc64le -target-abi elfv2 -v -dwarf-column-info
-coverage-file /tmp/t.cc -resource-dir
/gsa/tlbgsa-h1/09/andreyv/clang/bin/../lib/clang/3.6.1 -internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/c++/4.9
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/powerpc64le-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/powerpc64le-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/powerpc64le-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/gsa/tlbgsa-h1/09/andreyv/clang/bin/../lib/clang/3.6.1/include
-internal-externc-isystem /usr/include/powerpc64le-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 135 -mstackrealign -fno-signed-char -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
t.o -x c++ t.cc 
1.    <eof> parser at end of file
2.    t.cc:2:2: instantiating function definition 'S'
3.    t.cc:6:5: instantiating function definition 'A'
clang-3.6: error: unable to execute command: Aborted
clang-3.6: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.1 (tags/RELEASE_361/final)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
clang-3.6: 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-3.6: 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/20150615/ef2bd15b/attachment.html>


More information about the llvm-bugs mailing list