[LLVMbugs] [Bug 21923] New: fail to diagnose use of member in static method, crash later in codegen
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Dec 15 16:52:38 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=21923
Bug ID: 21923
Summary: fail to diagnose use of member in static method, crash
later in codegen
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: nlewycky at google.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Testcase:
template <typename T>
struct Base {
int member;
};
template <typename T>
struct Derived : public Base<T> {
static void Test();
using Base<T>::member;
};
template <typename T>
void Derived<T>::Test() {
member; // error: may not access member in static method.
}
template class Derived<int>;
GCC says:
$ g++ -std=gnu++11 b18754991.cc
b18754991.cc: In instantiation of ‘static void Derived<T>::Test() [with T =
int]’:
b18754991.cc:17:16: required from here
b18754991.cc:3:7: error: invalid use of member ‘Base<int>::member’ in static
member function
int member;
^
b18754991.cc:14:3: error: from this location
member; // error: may not access member in static method.
^
Clang finds no error here, then crashes in codegen with:
$ clang -cc1 -std=gnu++11 b18754991.cc -emit-llvm-only
b18754991.cc:14:3: warning: expression result unused
member; // error: may not access member in static method.
^~~~~~
b18754991.cc:17:16: note: in instantiation of member function
'Derived<int>::Test' requested here
template class Derived<int>;
^
Unhandled DeclRefExpr
UNREACHABLE executed at CGExpr.cpp:2010!
[...]
--
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/20141216/0492a600/attachment.html>
More information about the llvm-bugs
mailing list