https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82579

            Bug ID: 82579
           Summary: GCC 7/8
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ostash at ostash dot kiev.ua
  Target Milestone: ---

Hello,

The following code fails to compile with GCC 7/8, in C++17 mode (call to f(s)
is ambiguous):

---------------------------------
template <class T, class U = int> 
    class C
    {};

template <class T, class U>
    void f(const C<T, U>&) {}

template <class T, template <class> class CT>
    void f(CT<T>) {}

int main()
{
    C<int> s;
    f(s);
}
---------------------------------

However it compiles cleanly in C++14 mode.


This is a stripped case from boost::container::string:
https://github.com/boostorg/container/issues/58


Here
(https://groups.google.com/a/isocpp.org/d/topic/std-discussion/B1MHPRMqfFA/discussion)
we can find a suggestion that this is somehow related to CWG150 resolution by
P0522R0.

Clang accepts this code in both C++14 and C++17 mode, however they state that
CWG150 resolution "is disabled by default in all language versions" because
"the change to the standard lacks a corresponding change for template partial
ordering, resulting in ambiguity errors for reasonable and previously-valid
code" (https://clang.llvm.org/cxx_status.html#p0522).

Reply via email to