Sunday, December 15, 2013

Repost: Does anyone have a workaround for this gcc4.3 issue?

Newsgroup: comp.lang.c++

Subject: Repost: Does anyone have a workaround for this gcc4.3 issue?

From: huili80@...

Date: Sun, 15 Dec 2013 14:24:39 -0800 (PST)



The code attached compiles with gcc4.8 and above, however, gcc4.3 fails to compile, and i hope to find a workaround for gcc4.3 since that's currently the only compiler available to me (at work, that is).



The non-compile appears to be a gcc4.3 issue (bug maybe?), where a substitution failure, i.e., the instantiation of test<X> when calling f<X>(0), is mistakenly being treated as an error.



As for the code itself, since i'm using gcc4.3 which doesn't have c++11, therefore no decltype, so i had to use the gcc extension typeof, which is really the only thing non-standard about it.



I'd very much appreciate any help. Thanks!



code here:

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

template < typename T > T& obj();



template < typename T, typename=typeof(obj<T>().memfun()) >

struct test {};



template < typename T > test<T> f(int){}



template <typename> char f(...){}



struct X

{

void memfun(int){};

};



int main()

{

f<X>(0);

}







via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?151692-Repost-Does-anyone-have-a-workaround-for-this-gcc4-3-issue&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment