public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102721] New: out-of-line member function definition fails to allow lambda in unevaluated-context of  new feature in c++20
@ 2021-10-12 23:23 nickhuang99 at hotmail dot com
  2021-10-12 23:33 ` [Bug c++/102721] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: nickhuang99 at hotmail dot com @ 2021-10-12 23:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102721
           Summary: out-of-line member function definition fails to allow
                    lambda in unevaluated-context of  new feature in c++20
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nickhuang99 at hotmail dot com
  Target Milestone: ---

The following snippet code exposes that GCC parser doesn't comply with c++20
standard to allow lambda in unevaluated context. It seems this out-of-line
definition creates a new lambda type where lambda as operand of "decltype"
should be treated as in unevaluated context. So, it shouldn't create a new
lambda type in out-of-line definition.

Both clang and MSVC++ (https://www.godbolt.org/z/EMbb44fd8) parse this
correctly.
(with "-std=c++20")

template<class T>
struct A
{    
    void foo(const T){}
};

template<>
void A<decltype(+[]{})[3]>::foo(const decltype(+[]{})[3])
{}




<source>:9:6: error: ambiguating new declaration of 'void A<void (*
[3])()>::foo(void (* const*)())'
    9 | void A<decltype(+[]{})[3]>::foo(const decltype(+[]{})[3])
      |      ^~~~~~~~~~~~~~~~~~~~~
<source>:5:10: note: old declaration 'void A<T>::foo(T) [with T = void (*
[3])()]'
    5 |     void foo(const T){}
      |          ^~~

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

end of thread, other threads:[~2021-10-13 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 23:23 [Bug c++/102721] New: out-of-line member function definition fails to allow lambda in unevaluated-context of new feature in c++20 nickhuang99 at hotmail dot com
2021-10-12 23:33 ` [Bug c++/102721] " pinskia at gcc dot gnu.org
2021-10-12 23:35 ` pinskia at gcc dot gnu.org
2021-10-12 23:37 ` pinskia at gcc dot gnu.org
2021-10-13  8:51 ` nickhuang99 at hotmail dot com
2021-10-13 11:59 ` nickhuang99 at hotmail dot com

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).