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

            Bug ID: 58156
           Summary: c++11 bogus ambigous overload with variadic template
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref b/10321377

/// --- cut ---
template <class T, class... U>
void Foo(U&...) {}

template <class T, class... U>
void Foo(const U&...) {}

void Bar() {
  const int a = 0;
  Foo<int>(a);
}
/// --- cut ---

The test compiles with Clang, errors with current trunk GCC:
g++ (GCC) 4.9.0 20130814 (experimental)


g++ -c t.cc -std=c++11
t.cc: In function ‘void Bar()’:
t.cc:9:14: error: call of overloaded ‘Foo(const int&)’ is ambiguous
    Foo<int>(a);
              ^
t.cc:9:14: note: candidates are:
t.cc:2:7: note: void Foo(U& ...) [with T = int; U = {const int}]
  void Foo(U&...) {}
       ^
t.cc:5:7: note: void Foo(const U& ...) [with T = int; U = {int}]
  void Foo(const U&...) {}
       ^

Also broken with gcc-4.7.

Reply via email to