[Bug c++/16929] [3.4/3.5 Regression] ICE on taking address of member in default parameter to member function

mark at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Thu Aug 12 14:47:00 GMT 2004


------- Additional Comments From mark at codesourcery dot com  2004-08-12 14:47 -------
Subject: Re:  [3.4/3.5 Regression] ICE on taking address of
 member in default parameter to member function

reichelt at gcc dot gnu dot org wrote:

>------- Additional Comments From reichelt at gcc dot gnu dot org  2004-08-12 14:26 -------
>Mark, I don't think your fix for PR 16929 is the right approach.
>We still accept code like the following:
>
>=====================================
>template<typename> struct A {};
>
>template<typename T> struct B
>{
>    A<T> a;
>
>    void foo(A<T> = a);
>};
>=====================================
>
>which is invalid IMHO (we still reject it on the 3.3 branch as does
>icc with -strict_ansi).
>
My fix is certainly going to do no harm, and it probably helps with 
other situations that involve explicit use of the "this" keyword in the 
default arguments.  (Like "x = this").

The standard doesn't really say whether you have to diagnose this at 
declaration time, or instantiation time.  You're right that it's 
generally nice to catch things early.  You can file a PR, but I think 
it's a QoI issue, or a regression in terms of diagnostic quality.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16929



More information about the Gcc-bugs mailing list