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.
I can reproduce it with current mainline.
Looking.
Author: jason Date: Wed Dec 29 02:17:47 2010 New Revision: 168309 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168309 Log: PR c++/47068 * semantics.c (finish_id_expression): Don't note non-names as being used in the class. Added: trunk/gcc/testsuite/g++.dg/cpp0x/decltype24.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog
Fixed.