http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47068
Summary: [C++0x] internal compiler error on decltype(~
expression)
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The declaration
template <class T> struct broken {
int member;
typedef decltype(~ member) gcc_crashes_here;
};
generates the error message "internal compiler error: in lookup_member, at
cp/search.c:1200, Please submit a full bug report" when compiled with g++ 4.4.3
(with -std=c++0x, naturally.)
Similar code compiles without errors or warnings if any of the following
transformations are applied:
- A literal expression (e.g. "~ 0L") is substituted for "~ member"
- The operators !, &, -, +, or * (when member is changed to a pointer type)
are used instead of ~
- The struct is not templated
- The typedef is declared in a free function (even a templated free
function) rather than a class or struct
- decltype is replaced by typeof and the code is compiled without -std=c++0x
Unfortunately I'm traveling at the moment and can't easily test on other gcc
versions.