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

            Bug ID: 77449
           Summary: False ambiguity for variadic function with non-deduced
                    template parameter
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rbock at eudoxos dot de
  Target Milestone: ---

g++ considers the following code ambiguous:

template <typename X, typename Check, typename... T>
auto bar(Check, T...) -> void;

template <typename X, typename... T>
auto bar(int, T...) -> void;

int main()
{
  bar<void>(7, ""); // ambiguous according to gcc
  bar<void>(7);     // just fine
}


clang, msvc and icc agree that `auto bar(int, T...) -> void;` is more specific.
They therefore consider the code non-ambiguous.

Hint: The ambiguity is not seen by g++ if 
  - parameter T is non-variadic or
  - parameter X is removed

Reply via email to