public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114106] New: Wrong result of decltype
@ 2024-02-25 21:59 egor.pugin at gmail dot com
  2024-02-25 22:01 ` [Bug c++/114106] " pinskia at gcc dot gnu.org
  2024-04-13  8:36 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: egor.pugin at gmail dot com @ 2024-02-25 21:59 UTC (permalink / raw)
  To: gcc-bugs

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;} && ...)};
      |                  ^

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/114106] Wrong result of decltype
  2024-02-25 21:59 [Bug c++/114106] New: Wrong result of decltype egor.pugin at gmail dot com
@ 2024-02-25 22:01 ` pinskia at gcc dot gnu.org
  2024-04-13  8:36 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-25 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |c++-lambda
             Blocks|                            |107430

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>decltype([](Type<Ts>){})

Yes lambdas inside a decltype is known to cause issues.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107430
[Bug 107430] [meta-bug] lambda in decltype

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/114106] Wrong result of decltype
  2024-02-25 21:59 [Bug c++/114106] New: Wrong result of decltype egor.pugin at gmail dot com
  2024-02-25 22:01 ` [Bug c++/114106] " pinskia at gcc dot gnu.org
@ 2024-04-13  8:36 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13  8:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed on the trunk for GCC 14 by the recent lambda template patches.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-13  8:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-25 21:59 [Bug c++/114106] New: Wrong result of decltype egor.pugin at gmail dot com
2024-02-25 22:01 ` [Bug c++/114106] " pinskia at gcc dot gnu.org
2024-04-13  8:36 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).