<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 DiagnoseEmptyLookup"
href="http://llvm.org/bugs/show_bug.cgi?id=20582">20582</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>crash on invalid in DiagnoseEmptyLookup
</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 b16823516:
struct Test {
void TriggerInstantiation(int i) {
TemplatedMethod(i);
}
template <class T>
void TemplatedMethod(T x) {
NoSuchMember(x);
}
};
int Test::NoSuchMember;
nlewycky@ducttape:~$ clang -cc1 -std=gnu++11 -fsyntax-only reduced.cc
b16823516.cc:10:11: error: no member named 'NoSuchMember' in 'Test'
int Test::NoSuchMember;
~~~~~~^
b16823516.cc:7:5: error: use of undeclared identifier 'NoSuchMember'
NoSuchMember(x);
^
this->
b16823516.cc:3:5: note: in instantiation of function template specialization
'Test::TemplatedMethod<int>' requested here
TemplatedMethod(i);
^
(gdb) bt
#0 0x000000000112b54e in clang::FunctionTemplateDecl::getTemplatedDecl
(this=0x0) at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Frontend/../../include/clang/AST/DeclTemplate.h:809
#1 0x00000000018b371f in clang::Sema::DiagnoseEmptyLookup (this=0x6620cb0,
S=0x0, SS=..., R=..., CCC=..., ExplicitTemplateArgs=0x0, Args=...) at
SemaExpr.cpp:1783
#2 0x0000000001a304fd in clang::BuildRecoveryCallExpr (SemaRef=..., S=0x0,
Fn=0x664d150, ULE=0x664d150, LParenLoc=..., Args=..., RParenLoc=...,
EmptyLookup=true, AllowTypoCorrection=true) at SemaOverload.cpp:10471
#3 0x0000000001a30be4 in clang::FinishOverloadedCallExpr (SemaRef=..., S=0x0,
Fn=0x664d150, ULE=0x664d150, LParenLoc=..., Args=..., RParenLoc=...,
ExecConfig=0x0, CandidateSet=0x7fffffffa4c0, Best=0x7fffffffb898,
OverloadResult=clang::OR_No_Viable_Function, AllowTypoCorrection=true) at
SemaOverload.cpp:10576
#4 0x0000000001a312a9 in clang::Sema::BuildOverloadedCallExpr (this=0x6620cb0,
S=0x0, Fn=0x664d150, ULE=0x664d150, LParenLoc=..., Args=..., RParenLoc=...,
ExecConfig=0x0, AllowTypoCorrection=true) at SemaOverload.cpp:10661
#5 0x00000000018bee04 in clang::Sema::ActOnCallExpr (this=0x6620cb0, S=0x0,
Fn=0x664d150, LParenLoc=..., ArgExprs=..., RParenLoc=..., ExecConfig=0x0,
IsExecConfig=false) at SemaExpr.cpp:4545
#6 0x0000000001b3b812 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::RebuildCallExpr (this=0x7fffffffbfe0,
Callee=0x664d150, LParenLoc=..., Args=..., RParenLoc=..., ExecConfig=0x0) at
TreeTransform.h:1802
#7 0x0000000001b33295 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCallExpr (this=0x7fffffffbfe0,
E=0x664ccc8) at TreeTransform.h:7335
#8 0x0000000001b2b7bf in (anonymous
namespace)::TemplateInstantiator::TransformCallExpr (this=0x7fffffffbfe0,
CE=0x664ccc8) at SemaTemplateInstantiate.cpp:817
#9 0x0000000001b388cf in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr (this=0x7fffffffbfe0,
E=0x664ccc8) at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Sema/../../include/clang/AST/StmtNodes.inc:293
#10 0x0000000001b38305 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt (this=0x7fffffffbfe0,
S=0x664ccc8) at TreeTransform.h:2810
#11 0x0000000001b540ba in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt (this=0x7fffffffbfe0,
S=0x664ccf8, IsStmtExpr=false) at TreeTransform.h:5427
#12 0x0000000001b425ec in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCompoundStmt (this=0x7fffffffbfe0,
S=0x664ccf8) at TreeTransform.h:5414
#13 0x0000000001b37ba4 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformStmt (this=0x7fffffffbfe0,
S=0x664ccf8) at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Sema/../../include/clang/AST/StmtNodes.inc:79
#14 0x0000000001b31b19 in clang::Sema::SubstStmt (this=0x6620cb0, S=0x664ccf8,
TemplateArgs=...) at SemaTemplateInstantiate.cpp:2577
#15 0x0000000001b70aa5 in clang::Sema::InstantiateFunctionDefinition
(this=0x6620cb0, PointOfInstantiation=..., Function=0x664ca80, Recursive=true,
DefinitionRequired=false) at SemaTemplateInstantiateDecl.cpp:3437
#16 0x0000000001b7485f in clang::Sema::PerformPendingInstantiations
(this=0x6620cb0, LocalOnly=false) at SemaTemplateInstantiateDecl.cpp:4625
#17 0x00000000016e0b7e in clang::Sema::ActOnEndOfTranslationUnit
(this=0x6620cb0) at Sema.cpp:648
#18 0x0000000001633527 in clang::Parser::ParseTopLevelDecl (this=0x66235c0,
Result=...) at Parser.cpp:547
#19 0x000000000162c978 in clang::ParseAST (S=..., PrintStats=false,
SkipFunctionBodies=false) at ParseAST.cpp:145
#20 0x00000000010e8bae in clang::ASTFrontendAction::ExecuteAction
(this=0x65d51b0) at FrontendAction.cpp:514
#21 0x00000000010e86e3 in clang::FrontendAction::Execute (this=0x65d51b0) at
FrontendAction.cpp:415
#22 0x00000000010b32db in clang::CompilerInstance::ExecuteAction
(this=0x65d4390, Act=...) at CompilerInstance.cpp:810
#23 0x000000000107712c in clang::ExecuteCompilerInvocation (Clang=0x65d4390) at
ExecuteCompilerInvocation.cpp:222
#24 0x0000000001064a5b in cc1_main (ArgBegin=0x7fffffffd8c8,
ArgEnd=0x7fffffffd8e0, Argv0=0x7fffffffe7a2
"/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang",
MainAddr=0x10704c2 <GetExecutablePath(char const*, bool)>) at cc1_main.cpp:112
#25 0x000000000107199d in main (argc_=5, argv_=0x7fffffffe468) at
driver.cpp:319
(gdb) up
#1 0x00000000018b371f in clang::Sema::DiagnoseEmptyLookup (this=0x6620cb0,
S=0x0, SS=..., R=..., CCC=..., ExplicitTemplateArgs=0x0, Args=...) at
SemaExpr.cpp:1783
1783
getInstantiatedFromMemberTemplate()->getTemplatedDecl());
(gdb) l
1778 if (CurMethod->isDependentContext())
1779 DepMethod = CurMethod;
1780 else if (CurMethod->getTemplatedKind() ==
1781 FunctionDecl::TK_FunctionTemplateSpecialization)
1782 DepMethod =
cast<CXXMethodDecl>(CurMethod->getPrimaryTemplate()->
1783
getInstantiatedFromMemberTemplate()->getTemplatedDecl());
1784 else
1785 DepMethod = cast<CXXMethodDecl>(
1786 CurMethod->getInstantiatedFromMemberFunction());
1787 assert(DepMethod && "No template pattern found");
(gdb) p CurMethod
$1 = (clang::CXXMethodDecl *) 0x664ca80
(gdb) call CurMethod->dump()
CXXMethodDecl 0x664ca80 <b16823516.cc:6:3, col:27> col:8 used TemplatedMethod
'void (int)'
|-TemplateArgument type 'int'
`-ParmVarDecl 0x664c9c0 <col:24, col:26> col:26 used x 'int':'int'
(gdb) p CurMethod->getTemplatedKind()
$2 = clang::FunctionDecl::TK_FunctionTemplateSpecialization
(gdb) p CurMethod->getPrimaryTemplate()
$3 = (clang::FunctionTemplateDecl *) 0x664c7c0
(gdb) call CurMethod->getPrimaryTemplate()->dump()
FunctionTemplateDecl 0x664c7c0 <b16823516.cc:5:3, line:8:3> line:6:8
TemplatedMethod
|-TemplateTypeParmDecl 0x66076d0 <line:5:13, col:19> col:19 class T
|-CXXMethodDecl 0x664c720 <line:6:3, line:8:3> line:6:8 TemplatedMethod 'void
(T)'
| |-ParmVarDecl 0x664c620 <col:24, col:26> col:26 referenced x 'T'
| `-CompoundStmt 0x664ccf8 <col:29, line:8:3>
| `-CallExpr 0x664ccc8 <line:7:5, col:19> '<dependent type>'
| |-UnresolvedLookupExpr 0x664cc50 <col:5> '<overloaded function type>'
lvalue (ADL) = 'NoSuchMember' empty
| `-DeclRefExpr 0x664cca0 <col:18> 'T' lvalue ParmVar 0x664c620 'x' 'T'
`-CXXMethodDecl 0x664ca80 <line:6:3, col:27> col:8 used TemplatedMethod 'void
(int)'
|-TemplateArgument type 'int'
`-ParmVarDecl 0x664c9c0 <col:24, col:26> col:26 used x 'int':'int'
(gdb) p CurMethod->getPrimaryTemplate()->getInstantiatedFromMemberTemplate()
$4 = (clang::FunctionTemplateDecl *) 0x0</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>