[llvm-bugs] [Bug 24791] New: Clang crashes when suggesting unencessary "this->" fixit
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 11 17:35:12 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24791
Bug ID: 24791
Summary: Clang crashes when suggesting unencessary "this->"
fixit
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: rtrieu at google.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
push.cpp:
struct A {
void Run(int x) {
Get<>(x, x);
}
template <typename X>
void Get(X x, int y) {
// correct error message
//this->Set(x);
// correct error message
//Set(y);
// compiles
//Set(&x);
// crash
Set(x);
}
// comment either overload to prevent crash and get correct error messages
static void Set(int*) {}
static void Set(double*) {}
};
Command:
clang push.cpp
Output:
push.cpp:18:5: error: use of undeclared identifier 'Set'
Set(x);
^
this->
push.cpp:3:5: note: in instantiation of function template specialization
'A::Get<int>' requested here
Get<>(x, x);
^
The fixit "this->" for Set is not needed since the two Set functions are in
scope, and the various other calls to Set don't require it. The crash happens
at:
lib/Sema/SemaExpr.cpp:
1839 else if (CurMethod->getTemplatedKind() ==
1840 FunctionDecl::TK_FunctionTemplateSpecialization)
1841 DepMethod =
cast<CXXMethodDecl>(CurMethod->getPrimaryTemplate()->
1842 getInstantiatedFromMemberTemplate()->getTemplatedDecl());
getTemplateDecl() returns a null pointer. cast<CXXMethodDecl> then crashes
when passed that null pointer.
--
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/20150912/d6d211e2/attachment.html>
More information about the llvm-bugs
mailing list