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

            Bug ID: 114106
           Summary: Wrong result of decltype
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egor.pugin at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/ojbzGYqbW

MSVC works.

template <typename>
struct Type {};

template <typename... Ts>
struct ImplT : Ts...
{ using Ts::operator()...; };

template <typename... Ts>
using ImplA = ImplT<decltype([](Type<Ts>){})...>;

template <typename... Ts>
constexpr bool allUnique{
    ([]( ImplA<Ts...> x, Type<Ts> t )
    { x.operator()(t); return true;} && ...)}; // <- error is here

//static_assert(allUnique<int>); // also does not work

<source>: In lambda function:
<source>:16:18: error: request for member 'operator()' in 'x', which is of
non-class type 'int'
   16 |     { x.operator()(t); return true;} && ...)};
      |                  ^

Reply via email to