GCC 4.4 is supposed to support "SFINAE for expressions" - but the following
piece of code fails hard, without SFINAE 

----
typedef void Ft(int);
struct A { operator Ft*(); }; 
struct B { operator Ft*(); }; 
struct C : A, B { }; 

template<typename C> decltype(C()(0)) f(int); 
template<typename C> void f(...); 
int main() { f<C>(0); }
----

main.cpp: In function 'int main()':
main.cpp:8: error: conversion from 'C' to 'void (*)(int)' is ambiguous
main.cpp:3: note: candidates are: B::operator void (*)(int)()
main.cpp:2: note:                 A::operator void (*)(int)()
----

The call within the decltype specifier is ill-formed - which should be a
deduction failure but shouldn't cause the program to become ill-formed.


-- 
           Summary: SFINAE for expressions doesn't consider ambiguous
                    conversion sequences
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schaub-johannes at web dot de
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to