The following invalid C++ code is not diagnosed with -pedantic
by 4.4 or 4.5.

template <typename T1, typename T2> int f(T1 *, const T2 *) { return 0; }
template <typename T1, typename T2> int f(const T1 *, T2 *) { return 0; }

int (*p)(const int *, const int *) = f;

4.3 correctly diagnoses it:

t.C:4: error: converting overloaded function 'f' to type 'int (*)(const int*,
const int*)' is ambiguous
t.C:1: error: candidates are: int f(T1*, const T2*) [with T1 = const int, T2 =
int]
t.C:2: error:                 int f(const T1*, T2*) [with T1 = int, T2 = const
int]


-- 
           Summary: [4.4/4.5 Regression] ambiguous overload not diagnosed
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org


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

Reply via email to