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

            Bug ID: 70544
           Summary: Overload resolution with explicitly specified template
                    arguments
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roman.perepelitsa at gmail dot com
  Target Milestone: ---

When compiling this program:

  template <class... Args>
  void F(Args&&...);

  template <class T, class... Args>
  int F(Args&&...);

  int main() {
    int{F<int>(0)};
  }

Expected behavior: compile error (call to `F` is ambiguous).
Actual behaviour: compiles successfully.

Comment from Richard Smith: "I suspect this might be fallout from GCC's
workaround for core issue 1395 (after substituting explicitly-specified
template arguments, the first 'F' has one pack element deduced and the second
'F' has none, so I suspect the second may look more specialized under GCC's
approach to 1395 but not Clang's)."

Note that the following program gets rejected by GCC (as expected):

  template <class T>
  void F(T);

  template <class T, class U>
  void F(U);

  int main() {
    F<int>(0);
  }

Reply via email to