<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 --- - crash on invalid in instantiation after out-of-line declaration"
href="http://llvm.org/bugs/show_bug.cgi?id=17953">17953</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>crash on invalid in instantiation after out-of-line declaration
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nlewycky@google.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>Testcase in c++11:
template <template <typename> class Tmpl>
struct TemplateSel {
struct Bind {
typedef Tmpl<int> type;
};
};
template <class TestSel>
struct TypeParameterizedTest {
static void Register() {
typename TestSel::Bind::type TestClass;
}
};
template <typename>
class Cls {
virtual void TestBody();
};
auto test_ = TypeParameterizedTest<TemplateSel<Cls>>::Register;
template <typename T>
void Cls<T>::TestBody() {
class InnerCls {
void TestBody();
};
void InnerCls : TestBody();
}
Reproduce with clang -std=gnu++11 -fsyntax-only.
c.cc:23:17: error: unexpected ':' in nested name specifier; did you mean '::'?
void InnerCls : TestBody();
^
::
c.cc:23:19: error: out-of-line declaration of a member must be a definition
[-Wout-of-line-declaration]
void InnerCls : TestBody();
~~~~~~~~~~ ^
clang: /usr/local/google/home/nlewycky/llvm/include/llvm/Support/Casting.h:239:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
clang::CXXRecordDecl, Y = clang::DeclContext, typename llvm::cast_retty<X,
Y*>::ret_type = clang::CXXRecordDecl*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
0 clang 0x000000000335f2af llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1 clang 0x000000000335f536
2 clang 0x000000000335ef7a
3 libpthread.so.0 0x00007fa4677f7cb0
4 libc.so.6 0x00007fa466821425 gsignal + 53
5 libc.so.6 0x00007fa466824b8b abort + 379
6 libc.so.6 0x00007fa46681a0ee
7 libc.so.6 0x00007fa46681a192
8 clang 0x0000000000f00c25 llvm::cast_retty<clang::CXXRecordDecl,
clang::DeclContext*>::ret_type llvm::cast<clang::CXXRecordDecl,
clang::DeclContext>(clang::DeclContext*) + 62
9 clang 0x000000000167600e
clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*,
llvm::SmallVectorImpl<clang::ParmVarDecl*>&) + 242
10 clang 0x000000000167100e
clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*,
clang::TemplateParameterList*, bool) + 746
11 clang 0x00000000016748cc
clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*) + 42
12 clang 0x0000000001663b51
13 clang 0x00000000016750a2 clang::Sema::SubstDecl(clang::Decl*,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 142
14 clang 0x0000000001632d62
15 clang 0x0000000001648038
16 clang 0x000000000163e30b
17 clang 0x0000000001659a6a
18 clang 0x0000000001647f7a
19 clang 0x000000000163e2b5
20 clang 0x0000000001638cbe clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) + 134
21 clang 0x000000000167829f
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2407
22 clang 0x000000000167c24d
clang::Sema::PerformPendingInstantiations(bool) + 599
23 clang 0x00000000016783f3
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2747
24 clang 0x000000000167c24d
clang::Sema::PerformPendingInstantiations(bool) + 599
25 clang 0x000000000125e695 clang::Sema::ActOnEndOfTranslationUnit()
+ 613
26 clang 0x00000000011c3734
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 308
27 clang 0x00000000011bfb6d clang::ParseAST(clang::Sema&, bool, bool)
+ 597
28 clang 0x0000000000d609ef clang::ASTFrontendAction::ExecuteAction()
+ 321
29 clang 0x0000000000d6052e clang::FrontendAction::Execute() + 200
30 clang 0x0000000000d31bf8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 720
31 clang 0x0000000000d00526
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1018
32 clang 0x0000000000cf1358 cc1_main(char const**, char const**, char
const*, void*) + 717
33 clang 0x0000000000cfbbf6 main + 786
34 libc.so.6 0x00007fa46680c76d __libc_start_main + 237
35 clang 0x0000000000cf0a59
Stack dump:
0. Program arguments:
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name c.cc
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -resource-dir
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.4
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/x86_64-linux-gnu/c++/4.6
-internal-isystem /usr/local/include -internal-isystem
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.4/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=gnu++11 -fdeprecated-macro -fdebug-compilation-dir
/usr/local/google/home/nlewycky -ferror-limit 19 -fmessage-length 80
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -x c++ c.cc
1. <eof> parser at end of file
2. c.cc:9:15: instantiating function definition 'Register'
3. c.cc:15:16: instantiating function definition 'TestBody'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (trunk 194757) (llvm/trunk 188326:194757M)
Target: x86_64-unknown-linux-gnu
Thread model: posix</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>