[llvm-bugs] [Bug 43358] New: c++ parser crash on invalid code
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 19 03:04:30 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43358
Bug ID: 43358
Summary: c++ parser crash on invalid code
Product: clang
Version: 8.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: Emmanuel.Thome at inria.fr
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Created attachment 22526
--> https://bugs.llvm.org/attachment.cgi?id=22526&action=edit
complete source code
clang++ 8.0.1-3+b1 encounters a c++ crash on the attached code. I acknowledge
the fact that the code is invalid, but a parser crash should not occur.
Test source file, output, and reproducer attached.
template<bool happy>
struct pool {
bool ok() const { return happy; }
template<typename T> struct proxy {
bool ok() { return T::f.ok(); }
};
};
template<bool b> class obj {
typedef pool<b> pool_t;
static pool_t f;
public:
typedef typename pool_t::template proxy<obj> proxy_t;
template<> friend struct pool_t::proxy<obj>; // ***parser crash***
};
extern template class obj<true>;
int main()
{
obj<true>::proxy_t dummy;
return dummy.ok();
}
Here's a small bit of the full stack trace
#4 0x00000000016e777e
clang::Sema::MatchTemplateParametersToScopeSpecifier(clang::SourceLocation,
clang::SourceLocation, clang::CXXScopeSpec const&,
clang::TemplateIdAnnotation*,
llvm::ArrayRef<clang::TemplateParameterList*>, bool, bool&, bool&)
(/usr/lib/llvm-8/bin/clang+0x16e777e)
#5 0x00000000016fb471
clang::Sema::ActOnClassTemplateSpecialization(clang::Scope*, unsigned
int, clang::Sema::TagUseKind, clang::SourceLocation, clang::SourceLocation,
clang::TemplateIdAnnotation&, clang::ParsedAttributesView const&,
llvm::MutableArrayRef<clang::TemplateParameterList*>,
clang::Sema::SkipBodyInfo*)
(/usr/lib/llvm-8/bin/clang+0x16fb471)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190919/b216ab06/attachment-0001.html>
More information about the llvm-bugs
mailing list