<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - assertion failure instantiating member access into local class"
   href="http://llvm.org/bugs/show_bug.cgi?id=17139">17139</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>assertion failure instantiating member access into local class
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rjmccall@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>template <class T> void foo(const T &t) {
  t.foo();
}

template <class F> void bar(F *f) {
  struct B {
    F *fn;
    void foo() const {
      fn();
    }
  } b = { f };
  foo(b);
}

void go() {}

void test() {
  bar(go);
}

usury:clang$ clang -std=c++11 /tmp/red.cpp 
Assertion failed: (isa<LabelDecl>(D) && "declaration not instantiated in this
scope"), function findInstantiationOf, file
/Volumes/Data/llvm/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp, line 2758.
0  clang                    0x000000010cb7453e
llvm::sys::PrintStackTrace(__sFILE*) + 46
1  clang                    0x000000010cb7484b
PrintStackTraceSignalHandler(void*) + 27
2  clang                    0x000000010cb74bc8 SignalHandler(int) + 408
3  libsystem_platform.dylib 0x00007fff910605aa _sigtramp + 26
4  clang                    0x000000010b073199
clang::DeclContext::isDependentContext() const + 25
5  clang                    0x000000010cb7487b raise + 27
6  clang                    0x000000010cb74932 abort + 18
7  clang                    0x000000010cb74911 __assert_rtn + 129
8  clang                    0x000000010a3b858f
clang::LocalInstantiationScope::findInstantiationOf(clang::Decl const*) + 463
9  clang                    0x000000010a3efdee
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 238
10 clang                    0x000000010a3f4bd7
clang::Sema::FindInstantiatedContext(clang::SourceLocation,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 87
11 clang                    0x000000010a3f03c6
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 1734
12 clang                    0x000000010a3bbb67 (anonymous
namespace)::TemplateInstantiator::TransformDecl(clang::SourceLocation,
clang::Decl*) + 807
13 clang                    0x000000010a3c62d4 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformMemberExpr(clang::MemberExpr*) +
356
14 clang                    0x000000010a3b55cf clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 3247
15 clang                    0x000000010a3d1ee3 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) + 83
16 clang                    0x000000010a3c3122 (anonymous
namespace)::TemplateInstantiator::TransformCallExpr(clang::CallExpr*) + 66
17 clang                    0x000000010a3b4f7e clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) + 1630
18 clang                    0x000000010a3b45e3 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 1827
19 clang                    0x000000010a3cc9dd clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*,
bool) + 173
20 clang                    0x000000010a3d55ea clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*)
+ 42
21 clang                    0x000000010a3b40b8 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) + 504
22 clang                    0x000000010a3b3e95
clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList
const&) + 133
23 clang                    0x000000010a3fffdd
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 4061
24 clang                    0x000000010a401509
clang::Sema::PerformPendingInstantiations(bool) + 1433
25 clang                    0x000000010a400144
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 4420
26 clang                    0x000000010a401509
clang::Sema::PerformPendingInstantiations(bool) + 1433
27 clang                    0x000000010a400180
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 4480
28 clang                    0x000000010a401509
clang::Sema::PerformPendingInstantiations(bool) + 1433
29 clang                    0x0000000109efc8c3
clang::Sema::ActOnEndOfTranslationUnit() + 691
30 clang                    0x0000000109e73750
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 352
31 clang                    0x0000000109dea156 clang::ParseAST(clang::Sema&,
bool, bool) + 678
32 clang                    0x0000000109967b3a
clang::ASTFrontendAction::ExecuteAction() + 522
33 clang                    0x0000000109d46822
clang::CodeGenAction::ExecuteAction() + 1266
34 clang                    0x000000010996759f clang::FrontendAction::Execute()
+ 191
35 clang                    0x00000001099105b7
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 983
36 clang                    0x000000010986f9e6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1942
37 clang                    0x000000010985643d cc1_main(char const**, char
const**, char const*, void*) + 1821
38 clang                    0x00000001098671ec main + 636
39 libdyld.dylib            0x00007fff852215fd start + 1
Stack dump:
0.    Program arguments: /Volumes/Data/llvm-DA/Debug+Asserts/bin/clang -cc1
-triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-main-file-name red.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 142
-resource-dir /Volumes/Data/llvm-DA/Debug+Asserts/bin/../lib/clang/3.4
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/Volumes/Data/llvm/tools/clang -ferror-limit 19 -fmessage-length 80
-stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0
-fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties
-fencode-extended-block-signature -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o
/var/folders/bw/2pnl06t5557b29gnb_ytj9nh0000gn/T/red-b5d9a4.o -x c++
/tmp/red.cpp 
1.    <eof> parser at end of file
2.    /tmp/red.cpp:5:25: instantiating function definition 'bar'
3.    /tmp/red.cpp:1:25: instantiating function definition 'foo'
4.    /tmp/red.cpp:8:10: instantiating function definition 'foo'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (trunk 189569) (llvm/trunk 189567)
Target: x86_64-apple-darwin13.0.0</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>