<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Accessing invalid member of template class in other namespace causes ICE"
href="https://bugs.llvm.org/show_bug.cgi?id=51933">51933</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Accessing invalid member of template class in other namespace causes ICE
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>haydenflinner@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The following code triggers an ICE / segfault in older clangs, on the later
ones it simply errors out with return code 254 (and no error message or other
info):
namespace abc { // Yes, the namespace is necessary
template<typename T>
struct BusinessLogic {};
} // namespace abc
int main()
{
abc::BusinessLogic.ArbitraryStringHere;
}
--
Error:
1. <source>:8:10: current parser token 'BusinessLogic'
2. <source>:7:1: parsing function body 'main'
3. <source>:7:1: in compound statement ('{}')
#0 0x000055d6cedd6f7a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x27d6f7a)
#1 0x000055d6cedd4d44 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x27d4d44)
#2 0x000055d6cedd4e82 SignalHandler(int)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x27d4e82)
#3 0x00007f6777a853c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x000055d6d0bebc9c clang::DeclContext::lookup(clang::DeclarationName)
const (/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x45ebc9c)
#5 0x000055d6d0760a05 LookupDirect(clang::Sema&, clang::LookupResult&,
clang::DeclContext const*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x4160a05)
#6 0x000055d6d0761490 clang::Sema::LookupQualifiedName(clang::LookupResult&,
clang::DeclContext*, bool) (.part.1132)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x4161490)
#7 0x000055d6d0504581 clang::Sema::getTypeName(clang::IdentifierInfo const&,
clang::SourceLocation, clang::Scope*, clang::CXXScopeSpec*, bool, bool,
clang::OpaquePtr<clang::QualType>, bool, bool, bool, clang::IdentifierInfo**)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3f04581)
#8 0x000055d6d02f52cb
clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(clang::CXXScopeSpec&,
bool) (/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3cf52cb)
#9 0x000055d6d02f7e9f clang::Parser::TryAnnotateTypeOrScopeToken()
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3cf7e9f)
#10 0x000055d6d03a20a5
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da20a5)
#11 0x000055d6d03a27ef
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da27ef)
...
#253 0x000055d6d03a27ef
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da27ef)
#254 0x000055d6d03a27ef
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da27ef)
#255 0x000055d6d03a27ef
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da27ef)
clang-9: error: unable to execute command: Segmentation fault (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
Compiler returned: 254
--
<a href="https://godbolt.org/z/rTfGWGdPz">https://godbolt.org/z/rTfGWGdPz</a></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>