[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

--- Comment #15 from Marek Polacek  ---
Looks like this fix worked:

$ ./b2 toolset=gcc-10 -a
[...]
The Boost C++ Libraries were successfully built!

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #14 from Marek Polacek  ---
Hopefully fixed.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

--- Comment #13 from Marek Polacek  ---
Author: mpolacek
Date: Sat Sep 28 15:35:37 2019
New Revision: 276251

URL: https://gcc.gnu.org/viewcvs?rev=276251=gcc=rev
Log:
PR c++/91889 - follow-up fix for DR 2352.
* call.c (involves_qualification_conversion_p): New function.
(direct_reference_binding): Build a ck_qual if the conversion
would involve a qualification conversion.
(convert_like_real): Strip the conversion created by the ck_qual
in direct_reference_binding.

* g++.dg/cpp0x/ref-bind3.C: Add dg-error.
* g++.dg/cpp0x/ref-bind4.C: New test.
* g++.dg/cpp0x/ref-bind5.C: New test.
* g++.dg/cpp0x/ref-bind6.C: New test.
* g++.old-deja/g++.pt/spec35.C: Revert earlier change.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/ref-bind4.C
trunk/gcc/testsuite/g++.dg/cpp0x/ref-bind5.C
trunk/gcc/testsuite/g++.dg/cpp0x/ref-bind6.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/ref-bind3.C
trunk/gcc/testsuite/g++.old-deja/g++.pt/spec35.C

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
   Target Milestone|--- |10.0

--- Comment #12 from Marek Polacek  ---
ACK, will work on that.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-26 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

Jason Merrill  changed:

   What|Removed |Added

 Status|SUSPENDED   |NEW

--- Comment #11 from Jason Merrill  ---
(In reply to Marek Polacek from comment #7)
> Maybe the ranking needs additional wording, thus input from CWG.

Indeed, that's what I was thinking about at in my comment on your patch for PR
91877.  I think until we have a way to rank these conversions the DR is broken.
 I also think the obvious fix is to treat the reference binding as having an
implicit qualification conversion for purposes of comparison.

I'd also leave this PR open, not suspended; this is in fact a GCC 10
regression.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-26 Thread sje at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

--- Comment #10 from Steve Ellcey  ---
(In reply to Marek Polacek from comment #9)
> I'll raise it with CWG; suspending until then.

Not sure if it matters but there seem to be 8 instances of this problem in
Boost (get_color, get_left, get_next, get_parent, get_previous, get_right,
to_hook_ptr, and to_value_ptr).  The actual number of errors you get during a
boost build is much higher due to hitting these overload issues numerous times
during the build.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |SUSPENDED

--- Comment #9 from Marek Polacek  ---
I'll raise it with CWG; suspending until then.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-26 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

--- Comment #8 from Marc Glisse  ---
int i;
void f(int* const&) { }
void f(const int* const &) { }
void g(int* p) { f(p); }
void h() { f(); }

I find it painful that g is ambiguous, and confusing that h remains ok. It
needs confirmation that CWG really means for that to happen. The example the DR
wants to "fix" doesn't seem that important to me.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

--- Comment #7 from Marek Polacek  ---
Maybe the ranking needs additional wording, thus input from CWG.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

--- Comment #6 from Marek Polacek  ---
A similar testcase from the standard:

int g(const int &);
int g(int);
int i;
int k = g(i);   // ambiguous

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

Marek Polacek  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #5 from Marek Polacek  ---
I think this is not a bug, just a consequence of DR 2352.

The ICS in
void f(const int* const &);
converting "int *" to "const int *const &" no longer requires a qualification
conversion, and so its rank is cr_identity (before the DR it would be cr_exact
because of the qualification conversion).

The ICS in
void f(int*);
is and always was cr_identity too, because it's simply "int *" to "int *".

So now we have two standard conversion sequences with the same rank, and none
of the tiebreakers in [over.ics.rank] seem to apply.

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

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

void f(int*) { }
void f(const int* const &) { }
void g(int* p) { f(p); }



: In function 'void g(int*)':
:3:21: error: call of overloaded 'f(int*&)' is ambiguous
3 | void g(int* p) { f(p); }
  | ^
:1:6: note: candidate: 'void f(int*)'
1 | void f(int*) { }
  |  ^
:2:6: note: candidate: 'void f(const int* const&)'
2 | void f(const int* const &) { }
  |  ^
Compiler returned: 1

[Bug c++/91889] [10 Regression] error: call of overloaded ‘to_value_ptr(B*&)’ is ambiguous

2019-09-25 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91889

Martin Liška  changed:

   What|Removed |Added

 Status|WAITING |NEW
  Known to work||9.2.0
Summary|Boost does not build with   |[10 Regression] error: call
   |top-of-tree GCC |of overloaded
   ||‘to_value_ptr(B*&)’ is
   ||ambiguous
  Known to fail||10.0

--- Comment #3 from Martin Liška  ---
Reduced test-case:

template  struct A { typedef U *type; };
struct B {
  typedef A::type node_ptr;
};
struct C {
  typedef B::node_ptr node_ptr;
  typedef A::type const_node_ptr;
};
struct {
  void to_value_ptr(C::node_ptr) {};
  void to_value_ptr(const C::const_node_ptr &);
} b;
C::node_ptr a;
void fn1() { b.to_value_ptr(a); }