[Bug c++/77563] [5/6/7 Regression] explicit constructor breaks narrowing conversion overload resolution

2017-03-23 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77563

--- Comment #6 from Jason Merrill  ---
Author: jason
Date: Thu Mar 23 12:50:55 2017
New Revision: 246417

URL: https://gcc.gnu.org/viewcvs?rev=246417=gcc=rev
Log:
PR c++/77563 - missing ambiguous conversion error.

* call.c (convert_like_real): Use LOOKUP_IMPLICIT.

Added:
trunk/gcc/testsuite/g++.dg/overload/ambig3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c

[Bug c++/77563] [5/6/7 Regression] explicit constructor breaks narrowing conversion overload resolution

2017-03-21 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77563

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/77563] [5/6/7 Regression] explicit constructor breaks narrowing conversion overload resolution

2017-02-05 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77563

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||patrick at motec dot com.au

--- Comment #5 from Jeffrey A. Law  ---
*** Bug 78032 has been marked as a duplicate of this bug. ***

[Bug c++/77563] [5/6/7 Regression] explicit constructor breaks narrowing conversion overload resolution

2016-12-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77563

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/77563] [5/6/7 Regression] explicit constructor breaks narrowing conversion overload resolution

2016-09-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77563

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||jason at gcc dot gnu.org
   Target Milestone|--- |5.5

--- Comment #4 from Jakub Jelinek  ---
The 4.5 -> 4.6 difference appeared in r159332:

./cc1plus.159325 -quiet -std=c++0x pr77563.C
pr77563.C: In function ‘int main()’:
pr77563.C:12:7: error: conversion from ‘long int’ to ‘A’ is ambiguous
pr77563.C:3:3: note: candidates are: A::A(unsigned int)
pr77563.C:2:3: note: A::A(int)
./cc1plus.159332 -quiet -std=c++0x pr77563.C
pr77563.C: In function ‘int main()’:
pr77563.C:12:7: error: converting to ‘A’ from initializer list would use
explicit constructor ‘A::A(long int)’

then r229283 started to ICE on it instead, and finally r236395 fixed the ICE,
but emitted a note without corresponding error/warning:

./cc1plus.236395 -quiet -std=c++0x pr77563.C
pr77563.C: In function ‘int main()’:
pr77563.C:8:6: note:   initializing argument 1 of ‘void f(A)’
 void f(A) { }
  ^

[Bug c++/77563] [5/6/7 Regression] explicit constructor breaks narrowing conversion overload resolution

2016-09-13 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77563

--- Comment #3 from Jonathan Wakely  ---
Reduced:

struct A {
  A(int) {}
  A(unsigned) {}  // Comment to make it work

  explicit A(long) {}  // Comment to make it work
};

void f(A) { }

int main() {
  f(2);
  f(3l);
}

[Bug c++/77563] [5/6/7 Regression] explicit constructor breaks narrowing conversion overload resolution

2016-09-13 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77563

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-13
  Known to work||4.5.4
Summary|explicit constructor breaks |[5/6/7 Regression] explicit
   |narrowing conversion|constructor breaks
   |overload resolution |narrowing conversion
   ||overload resolution
 Ever confirmed|0   |1
  Known to fail||5.4.0, 6.2.0, 7.0

--- Comment #2 from Jonathan Wakely  ---
4.5.4 got this right:

ex.cc: In function ‘int main()’:
ex.cc:15:7: error: conversion from ‘long int’ to ‘A’ is ambiguous
ex.cc:6:3: note: candidates are: A::A(uint32_t)
ex.cc:5:3: note: A::A(int32_t)

Since GCC 4.6 the error has been misleading, and since GCC 6 it's
accepts-invalid.