g++ fails with an internal compiler error ("in type_dependent_expression_p, at cp/pt.c:12030") when compiling code where a method name is passed without the reference (ampersand) operator (which is syntactically wrong) as a template argument. Reproducible: Always Steps to Reproduce: 1. Try to compile code containing the following snippet: == template <class T, void (AbstractDelayed<T>::*func) (xmmsc_result_t*)> void runDelayedMethod(xmmsc_result_t *res, void *del_ptr) { AbstractDelayed<T>* d = (AbstractDelayed<T>*)del_ptr; (d->*func)(res); } template <class T> AbstractDelayed<T>::AbstractDelayed(xmmsc_result_t* res, const char* err) : errmsg(err) { xmmsc_result_notifier_set(res, &runDelayedMethod<T, AbstractDelayed<T>::callback>, this); xmmsc_result_unref(res); } == using g++. 2. Putting back the ampersand ("&AbstractDelayed<T>::callback>") solves the problem. Actual Results: g++ fails with the following error: delayed.hh: In constructor `AbstractDelayed<T>::AbstractDelayed(xmmsc_result_t*, const char*) [with T = bool]': delayed.hh:185: instantiated from `Delayed<T>::Delayed(xmmsc_result_t*, ProductMaker<T>*, const char*) [with T = bool]' playback.cc:86: instantiated from here delayed.hh:129: internal compiler error: in type_dependent_expression_p, at cp/pt.c:12030 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://bugs.gentoo.org/> for instructions. Preprocessed source stored into /tmp/ccyvcn7E.out file, please attach this to your bugreport. make: *** [playback.o] Error 1 Expected Results: Putting the ampersand before the method name solves the problem and the program compiles and runs fine. Using g++ (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8).
Created attachment 73837 [details] Source code that fails to compile (won't compile alone). This code comes from the nyello project, with full source code available at http://git.xmms.se/?p=nyello.git;a=summary Of course the code in the repository does not present the error, but removing the reference operator as indicated in the bug description allows reproduction of the bug.
Created attachment 73838 [details] Preprocessed source dumped in /tmp by g++ after failure.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19004 This seems to be the same bug. I can confirm the preprocessed source doesn't ICE 3.4.5 anymore. I'll look into backporting the patch so we can add it into our patchset for 3.4.4.
Fixed.