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



Jason Merrill <jason at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |jason at gcc dot gnu.org



--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2013-02-13 
18:56:17 UTC ---

13.5.6 says, "An expression x->m is interpreted as (x.operator->())->m for a

class object x of type T if T::operator->() exists and if the operator is

selected as the best match function by the overload resolution mechanism

(13.3)."



So by repeated application of this rule a->x becomes

a.operator->().operator->().operator->().operator->()...->x, which does in fact

require 10000 instantiations of mooch to evaluate.  Given how long clang takes

to compile this testcase, it seems that they are also doing all the

instantiations, they just aren't counting them as nested and so if the

terminating specialization isn't present it will keep going until resources are

exhausted.



It's not clear to me that this behavior is better than flagging the extreme

chain as G++ does; we used to do the same as clang, but changed in response to

bug 49118.

Reply via email to