Community
Participate
Working Groups
For the following code: template <bool B, class T = void> struct enable_if { typedef T type; }; template <class T> struct enable_if<false, T> {}; template <typename T> struct is_int { static const bool value = false; }; template <> struct is_int<int> { static const bool value = true; }; template <typename T> typename enable_if<!is_int<T>::value>::type function(T); template <typename T> typename enable_if<is_int<T>::value>::type function(T); void g() { function(0); // ERROR HERE } The parser gives the error: 'function' is ambiguous ' Candidates are: void function(int) ? function(int) ' The code compiles fine with g++ (and overload resolution selects the second overload).
Created attachment 188598 [details] testcase + fix
Fixed in 8.0 > 20110209.
*** cdt cvs genie on behalf of mschorn *** Bug 336426: Syntax failure in return type of function instance. [*] CPPTemplates.java 1.131 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java?root=Tools_Project&r1=1.130&r2=1.131 [*] AST2TemplateTests.java 1.206 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java?root=Tools_Project&r1=1.205&r2=1.206