Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 114012 - g++ internal compiler error when passing a function name instead of reference
Summary: g++ internal compiler error when passing a function name instead of reference
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/bugzilla/show_bug....
Whiteboard: 3.4.4-r2
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-30 04:08 UTC by Theefer
Modified: 2005-12-22 21:56 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Source code that fails to compile (won't compile alone). (delayed.hh,4.60 KB, text/plain)
2005-11-30 04:11 UTC, Theefer
Details
Preprocessed source dumped in /tmp by g++ after failure. (cc3jjS6s.out,818.39 KB, text/plain)
2005-11-30 04:12 UTC, Theefer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Theefer 2005-11-30 04:08:53 UTC
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).
Comment 1 Theefer 2005-11-30 04:11:29 UTC
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.
Comment 2 Theefer 2005-11-30 04:12:18 UTC
Created attachment 73838 [details]
Preprocessed source dumped in /tmp by g++ after failure.
Comment 3 Mark Loeser (RETIRED) gentoo-dev 2005-12-15 01:40:58 UTC
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.
Comment 4 Mark Loeser (RETIRED) gentoo-dev 2005-12-22 21:56:20 UTC
Fixed.