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

            Bug ID: 124954
           Summary: [c++20] ‘using_decl’ not supported by expression
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcel at laverdet dot com
  Target Milestone: ---

// foo.cc
struct foo {
  auto xx() -> void {}
};

template <class T>
struct bar : T {
  using T::xx;
  auto operator()() -> void
    requires requires { xx(); } {}
};

auto yy() {
  bar<foo> bb{};
  bb();
}

-----

root[17:27:22] [/workspace] $ g++ -std=c++20 foo.cc -c
foo.cc: In function ‘auto yy()’:
foo.cc:14:5: error: no match for call to ‘(bar<foo>) ()’
   14 |   bb();
      |   ~~^~
foo.cc:6:8: note: there is 1 candidate
    6 | struct bar : T {
      |        ^~~
foo.cc:8:8: note: candidate 1: ‘void bar<T>::operator()() requires
requires{(‘using_decl’ not supported by expression)();} [with T = foo]’
    8 |   auto operator()() -> void
      |        ^~~~~~~~
foo.cc:8:8: note: constraints not satisfied
foo.cc: In instantiation of ‘void bar<T>::operator()() requires
requires{(‘using_decl’ not supported by expression)();} [with T = foo]’:
foo.cc:14:5:   required from here
   14 |   bb();
      |   ~~^~
foo.cc:8:8:   required by the constraints of ‘template<class T> void
bar<T>::operator()() requires requires{(‘using_decl’ not supported by
expression)();}’
foo.cc:9:14:   in requirements  [with T = foo]
foo.cc:9:27: note: the required expression ‘T::xx()’ is invalid
    9 |     requires requires { xx(); } {}
      |                         ~~^~
cc1plus: note: set ‘-fconcepts-diagnostics-depth=’ to at least 2 for more
detail

-----

Observed on gcc 15 and gcc 16 trunk. clang compiles fine.

Reply via email to