Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Bestest Sepples Program Evar

Name: Anonymous 2010-07-27 22:39

I have maded the bestest sepples program ever.  Please compile and run to tell having of results.


template<class T> struct L { L<T*> operator->(); };
int main(int argc, char *argv[])
{
    L<int> i, j = i->yes;
    return 0;
}

Name: Anonymous 2010-07-28 12:43

>>7
No, the compiler will just run for days until it runs your system out of memory. g++, clang and icc all do this.

The "yes" in i->yes doesn't actually matter; i-> is actually a function call, so the compiler needs to resolve its return value first in order to determine whether it has a "yes" attribute. i-> is L<int>::operator->(), so it instantiatues L<int> and determines the operator returns L<int*>. So it instantiates L<int>. It then determines L<int*> has an operator which returns L<int**>, so it instantiates L<int**>, which then instantiates L<int***>, and so on ad infinitum. I think.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List