<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: Assertion `!Init->isValueDependent()' failed."
href="http://llvm.org/bugs/show_bug.cgi?id=20972">20972</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>crash on invalid: Assertion `!Init->isValueDependent()' failed.
</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:
class A {
template <typename CType> void B();
};
namespace {
template <typename CType> void A::B() {
const int a = sizeof(CType);
int b = a;
}
}
Crash:
nlewycky@ducttape:~$ llvm/Debug+Asserts/bin/clang b.cc
b.cc:5:35: error: cannot define or redeclare 'B' here because namespace '' does
not enclose namespace 'A'
template <typename CType> void A::B() {
~~~^
clang: Decl.cpp:2097: bool clang::VarDecl::checkInitIsICE() const: Assertion
`!Init->isValueDependent()' failed.
Program received signal SIGABRT, Aborted.
(gdb) bt
#0 0x00007ffff69c6bb9 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007ffff69c9fc8 in __GI_abort () at abort.c:89
#2 0x00007ffff69bfa76 in __assert_fail_base (fmt=0x7ffff6b11370 "%s%s%s:%u:
%s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x48cc395
"!Init->isValueDependent()", file=file@entry=0x48cbe19 "Decl.cpp",
line=line@entry=2097, function=function@entry=0x48d6a60
<clang::VarDecl::checkInitIsICE() const::__PRETTY_FUNCTION__> "bool
clang::VarDecl::checkInitIsICE() const") at assert.c:92
#3 0x00007ffff69bfb22 in __GI___assert_fail (assertion=0x48cc395
"!Init->isValueDependent()", file=0x48cbe19 "Decl.cpp", line=2097,
function=0x48d6a60 <clang::VarDecl::checkInitIsICE()
const::__PRETTY_FUNCTION__> "bool clang::VarDecl::checkInitIsICE() const") at
assert.c:101
#4 0x0000000002700a48 in clang::VarDecl::checkInitIsICE (this=0x6696f90) at
Decl.cpp:2097
#5 0x0000000001945cec in clang::IsVariableAConstantExpression (Var=0x6696f90,
Context=...) at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Sema/../../include/clang/Sema/SemaInternal.h:47
#6 0x000000000197d530 in DoMarkVarDeclReferenced (SemaRef=..., Loc=...,
Var=0x6696f90, E=0x66970b8) at SemaExpr.cpp:12550
#7 0x000000000197d62e in MarkExprReferenced (SemaRef=..., Loc=...,
D=0x6696f90, E=0x66970b8, OdrUse=true) at SemaExpr.cpp:12570
#8 0x000000000197d797 in clang::Sema::MarkDeclRefReferenced (this=0x6669d50,
E=0x66970b8) at SemaExpr.cpp:12603
#9 0x000000000194e367 in clang::Sema::BuildDeclRefExpr (this=0x6669d50,
D=0x6696f90, Ty=..., VK=clang::VK_LValue, NameInfo=..., SS=0x7fffffff8f30,
FoundD=0x6696f90, TemplateArgs=0x0) at SemaExpr.cpp:1675
#10 0x0000000001952ecd in clang::Sema::BuildDeclarationNameExpr
(this=0x6669d50, SS=..., NameInfo=..., D=0x6696f90, FoundD=0x6696f90,
TemplateArgs=0x0) at SemaExpr.cpp:2900
#11 0x000000000195255f in clang::Sema::BuildDeclarationNameExpr
(this=0x6669d50, SS=..., R=..., NeedsADL=false) at SemaExpr.cpp:2670
#12 0x0000000001950794 in clang::Sema::ActOnIdExpression (this=0x6669d50,
S=0x66778f0, SS=..., TemplateKWLoc=..., Id=..., HasTrailingLParen=false,
IsAddressOfOperand=false, CCC=0x7fffffff8ef0, IsInlineAsmIdentifier=false) at
SemaExpr.cpp:2197
#13 0x0000000001704492 in clang::Parser::ParseCastExpression (this=0x666c700,
isUnaryExpression=false, isAddressOfOperand=false, NotCastExpr=@0x7fffffff95ff:
false, isTypeCast=clang::Parser::NotTypeCast) at ParseExpr.cpp:821
#14 0x00000000017035de in clang::Parser::ParseCastExpression (this=0x666c700,
isUnaryExpression=false, isAddressOfOperand=false,
isTypeCast=clang::Parser::NotTypeCast) at ParseExpr.cpp:417
#15 0x00000000017026e3 in clang::Parser::ParseAssignmentExpression
(this=0x666c700, isTypeCast=clang::Parser::NotTypeCast) at ParseExpr.cpp:169
#16 0x00000000016d6d30 in clang::Parser::ParseInitializer (this=0x666c700) at
/usr/local/google/home/nlewycky/llvm/tools/clang/lib/Parse/../../include/clang/Parse/Parser.h:1531
#17 0x00000000016def37 in
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes (this=0x666c700,
D=..., TemplateInfo=..., FRI=0x0) at ParseDecl.cpp:1848
#18 0x00000000016de19f in clang::Parser::ParseDeclGroup (this=0x666c700,
DS=..., Context=7, AllowFunctionDefinitions=false, DeclEnd=0x7fffffffa4a0,
FRI=0x0) at ParseDecl.cpp:1641
#19 0x00000000016dd622 in clang::Parser::ParseSimpleDeclaration
(this=0x666c700, Stmts=..., Context=7, DeclEnd=..., Attrs=...,
RequireSemi=true, FRI=0x0) at ParseDecl.cpp:1396
#20 0x00000000016dd370 in clang::Parser::ParseDeclaration (this=0x666c700,
Stmts=..., Context=7, DeclEnd=..., attrs=...) at ParseDecl.cpp:1341
#21 0x00000000017353b5 in
clang::Parser::ParseStatementOrDeclarationAfterAttributes (this=0x666c700,
Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0, Attrs=...) at
ParseStmt.cpp:211
#22 0x0000000001734d0c in clang::Parser::ParseStatementOrDeclaration
(this=0x666c700, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0) at
ParseStmt.cpp:107
#23 0x0000000001737a93 in clang::Parser::ParseCompoundStatementBody
(this=0x666c700, isStmtExpr=false) at ParseStmt.cpp:938
#24 0x000000000173ae1a in clang::Parser::ParseFunctionStatementBody
(this=0x666c700, Decl=0x0, BodyScope=...) at ParseStmt.cpp:1857
#25 0x00000000016cd5c1 in clang::Parser::ParseFunctionDefinition
(this=0x666c700, D=..., TemplateInfo=..., LateParsedAttrs=0x7fffffffac90) at
Parser.cpp:1098
#26 0x0000000001741fdf in clang::Parser::ParseSingleDeclarationAfterTemplate
(this=0x666c700, Context=0, TemplateInfo=..., DiagsFromTParams=...,
DeclEnd=..., AS=clang::AS_none, AccessAttrs=0x0) at ParseTemplate.cpp:272
#27 0x00000000017416c8 in
clang::Parser::ParseTemplateDeclarationOrSpecialization (this=0x666c700,
Context=0, DeclEnd=..., AS=clang::AS_none, AccessAttrs=0x0) at
ParseTemplate.cpp:145
#28 0x00000000017412ad in clang::Parser::ParseDeclarationStartingWithTemplate
(this=0x666c700, Context=0, DeclEnd=..., AS=clang::AS_none, AccessAttrs=0x0) at
ParseTemplate.cpp:39
#29 0x00000000016dd1ae in clang::Parser::ParseDeclaration (this=0x666c700,
Stmts=..., Context=0, DeclEnd=..., attrs=...) at ParseDecl.cpp:1315
#30 0x00000000016cbbbe in clang::Parser::ParseExternalDeclaration
(this=0x666c700, attrs=..., DS=0x0) at Parser.cpp:701
#31 0x00000000016f18c9 in clang::Parser::ParseInnerNamespace (this=0x666c700,
IdentLoc=std::vector of length 0, capacity 0, Ident=std::vector of length 0,
capacity 0, NamespaceLoc=std::vector of length 0, capacity 0, index=0,
InlineLoc=..., attrs=..., Tracker=...) at ParseDeclCXX.cpp:209
#32 0x00000000016f173f in clang::Parser::ParseNamespace (this=0x666c700,
Context=0, DeclEnd=..., InlineLoc=...) at ParseDeclCXX.cpp:186
#33 0x00000000016dd2c0 in clang::Parser::ParseDeclaration (this=0x666c700,
Stmts=..., Context=0, DeclEnd=..., attrs=...) at ParseDecl.cpp:1329
#34 0x00000000016cbbbe in clang::Parser::ParseExternalDeclaration
(this=0x666c700, attrs=..., DS=0x0) at Parser.cpp:701
#35 0x00000000016cb450 in clang::Parser::ParseTopLevelDecl (this=0x666c700,
Result=...) at Parser.cpp:559
#36 0x00000000016c4d1e in clang::ParseAST (S=..., PrintStats=false,
SkipFunctionBodies=false) at ParseAST.cpp:145
#37 0x000000000116c3d6 in clang::ASTFrontendAction::ExecuteAction
(this=0x661db30) at FrontendAction.cpp:522
#38 0x000000000143484b in clang::CodeGenAction::ExecuteAction (this=0x661db30)
at CodeGenAction.cpp:717
#39 0x000000000116beb1 in clang::FrontendAction::Execute (this=0x661db30) at
FrontendAction.cpp:423
#40 0x000000000113438e in clang::CompilerInstance::ExecuteAction
(this=0x661b380, Act=...) at CompilerInstance.cpp:811
#41 0x00000000010f63c1 in clang::ExecuteCompilerInvocation (Clang=0x661b380) at
ExecuteCompilerInvocation.cpp:222
#42 0x00000000010e318a in cc1_main (Argv=..., Argv0=0x7fffffffe070
"/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang",
MainAddr=0x10ef026 <GetExecutablePath(char const*, bool)>) at cc1_main.cpp:110
#43 0x00000000010f06e8 in ExecuteCC1Tool (argv=..., Tool=...) at driver.cpp:368
#44 0x00000000010f0c94 in main (argc_=60, argv_=0x7fffffffdab8) at
driver.cpp:411</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>