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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=113191

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
I tried implementing the missing inherited vs non-inherited check from CWG2789
in cand_parms_match which fixes this testcase but it causes concepts-memfun4.C
(added by r14-7157) to regress with excess errors.  The new errors/behavior
seem correct to me, so I must be missing something...

Before/after diff of concepts-memfun4.C:

@@ -1,3 +1,34 @@
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:26:25: error: static assertion
failed
+   26 | static_assert(S<>{}.f() == 5);
+      |               ~~~~~~~~~~^~~~
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:26:25: note: the comparison
reduces to ‘(10 == 5)’
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:27:22: error: call of overloaded
‘g()’ is ambiguous
+   27 | static_assert(S<>{}.g() == 5);
+      |               ~~~~~~~^~
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:10:17: note: candidate:
‘constexpr int B<T>::g(this S<T>&&) requires  true [with T = void]’
+   10 |   constexpr int g(this S<T>&&) requires true { return 5; }
+      |                 ^
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:21:17: note: candidate:
‘constexpr int S< <template-parameter-1-1> >::g() [with
<template-parameter-1-1> = void]’
+   21 |   constexpr int g() { return 10; }
+      |                 ^
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:28:22: error: call of overloaded
‘h()’ is ambiguous
+   28 | static_assert(S<>{}.h() == 5);
+      |               ~~~~~~~^~
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:11:17: note: candidate:
‘constexpr int B<T>::h() requires  true [with T = void]’
+   11 |   constexpr int h() requires true { return 5; }
+      |                 ^
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:22:17: note: candidate:
‘constexpr int S< <template-parameter-1-1> >::h(this S<
<template-parameter-1-1> >&&) [with <template-parameter-1-1> = void]’
+   22 |   constexpr int h(this S&&) { return 10; }
+      |                 ^
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:41:15: error: conversion from
‘S2<>’ to ‘int’ is ambiguous
+   41 | static_assert(S2<>{} == 5);
+      |               ^~~~~~
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:33:13: note: candidate:
‘constexpr C< <template-parameter-1-1> >::operator int() const [with
<template-parameter-1-1> = void]’
+   33 |   constexpr operator int () const { return 15; }
+      |             ^~~~~~~~
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:9:13: note: candidate:
‘constexpr B<T>::operator int() const requires  true [with T = void]’
+    9 |   constexpr operator int () const requires true { return 5; }
+      |             ^~~~~~~~
 gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:46:22: error: request for member
‘f’ is ambiguous
    46 | static_assert(S2<>{}.f() == 5); // { dg-error "ambiguous" }
       |                      ^
@@ -16,6 +47,19 @@ gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:8:17: note:
candidate: ‘constexp
 gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:51:17: note: candidate:
‘constexpr int S3< <template-parameter-1-1> >::f() volatile [with
<template-parameter-1-1> = void]’
    51 |   constexpr int f() volatile { return 10; }
       |                 ^
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:64:23: warning: ISO C++ says
that these are ambiguous, even though the worst conversion for the first is
better than the worst conversion for the second:
+   64 | static_assert(S4<>{}.f() == 5);
+      |               ~~~~~~~~^~
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:60:17: note: candidate 1:
‘constexpr int S4< <template-parameter-1-1> >::f() const & [with
<template-parameter-1-1> = void]’
+   60 |   constexpr int f() const & { return 10; }
+      |                 ^
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:8:17: note: candidate 2:
‘constexpr int B<T>::f() const requires  true [with T = void]’
+    8 |   constexpr int f() const requires true { return 5; }
+      |                 ^
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:64:26: error: static assertion
failed
+   64 | static_assert(S4<>{}.f() == 5);
+      |               ~~~~~~~~~~~^~~~
+gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:64:26: note: the comparison
reduces to ‘(10 == 5)’
 gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C:75:15: error: conversion from
‘S5<>’ to ‘int’ is ambiguous
    75 | static_assert(S5<>{} == 5);     // { dg-error "ambiguous" }
       |               ^~~~~~

Reply via email to