This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/42336] [4.5 Regression] ICE with pointer-to-member-function argument in template function
- From: "jamborm at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jan 2010 18:16:34 -0000
- Subject: [Bug c++/42336] [4.5 Regression] ICE with pointer-to-member-function argument in template function
- References: <bug-42336-17896@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from jamborm at gcc dot gnu dot org 2010-01-07 18:16 -------
The ICE happens within count_non_default_template_args which (as far
as I understand it) somehow re-creates each template parameter to see
whether it is the default one (and increments a counter if it is). I
am not exactly sure what the option 1b means but we get an ICE even
when the template does not have default parameters:
struct X {
void func() {}
void f2() {}
};
template<typename T, void (X::*P)() = &T::func>
void b(T) {}
int main() {
b<X, &X::f2>(X()); /* line 9 */
X().func();
return 0;
}
I also do not quite understand what the option 2 means. If we remove
the this pointer, the method is no longer a method and thus is
sensibly turned into a function. Gcc does this IPA-CP since 4.4 and
in IPA-SRA in trunk, primarily because of some ICEs that happen if we
don't (Honza would know more but I would suspect they were also
related to debug info).
(1a sounds nice. However, since my knowledge and experience with debug
info (not to mention C++) code is rather limited, I would like to
discuss what needs to be done in much more detail before attempting it
myself. But it certainly looks interesting.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42336