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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-04-29
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |5.3.0, 6.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The example in the core issue compiles fine with both 6.0 and 5.3 (see below)
but the provided test case does not.  Based on my reading of the relevant
paragraphs of the current working paper (N4567) I agree the test case is valid
and the call should resolve to the first overload of f (i.e., int
f(int(&&)[1])).

$ cat x.cpp && g++ -S -Wall -Wextra -Wpedantic -std=c++14 -xc++ x.cpp
void f (int const(&)[1]);
void f (int const(&)[2]);

int main ()
{
  f ({1});
}
x.cpp: In function ‘int main()’:
x.cpp:6:9: error: call of overloaded ‘f(<brace-enclosed initializer list>)’ is
ambiguous
   f ({1});
         ^
x.cpp:1:6: note: candidate: void f(const int (&)[1])
 void f (int const(&)[1]);
      ^
x.cpp:2:6: note: candidate: void f(const int (&)[2])
 void f (int const(&)[2]);
      ^

Test case from core issue 1307:
$ cat x.cpp && ~/bin/gcc-5.1.0/bin/g++ -S -Wall -Wextra -Wpedantic -std=c++14
-xc++ x.cpp
void f (int const(&)[2]);
void f (int const(&)[3]);

int main ()
{
  f ({1, 2, 3});
}
$

Reply via email to