[Bug c++/54890] New: Incorrect SFINAE Rejection

pmenso57 at comcast dot net gcc-bugzilla@gcc.gnu.org
Wed Oct 10 15:19:00 GMT 2012


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

             Bug #: 54890
           Summary: Incorrect SFINAE Rejection
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pmenso57@comcast.net


When explicitly specifying the template parameters to a function template in
the following context, the compiler incorrectly removes the function from the
overload set for a substitution failure which should not exist.

struct A {
    template<class T> struct apply { };
};

template<class T, class... U>
void f(typename T::template apply<U...>*) { }

int main() {
    f<A, int>(nullptr);
    return 0;
}

Output from the compiler is:

In function ‘int main()’:
error: no matching function for call to ‘f(std::nullptr_t)’
note: candidate is:
note: template<class T, class ... U> void f(typename T::apply<U ...>*)
note:   template argument deduction/substitution failed:
note:   mismatched types ‘A::apply<U ...>*’ and ‘std::nullptr_t’

Which I believe is incorrect.



More information about the Gcc-bugs mailing list