public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104138] New: ICE when lambda is passed as parameter
@ 2022-01-20  4:06 nickhuang99 at hotmail dot com
  2022-01-20  4:10 ` [Bug c++/104138] ICE in is_base_type with lambda is passed as parameter with -g pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nickhuang99 at hotmail dot com @ 2022-01-20  4:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104138
           Summary: ICE when lambda is passed as parameter
           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: ---

Considering following valid code which compiles with clang13. It defines a
concept to restrict template parameter as type of lambda. Then the concept is
used to constraint class A to have a lambda as constructor parameter. The ICE
happens when a lambda object is passed to constructor of A.  


#include<type_traits>

using Lambda=decltype(+[](){});
template<typename T>
concept IsLambda=std::is_same<decltype(+[](){}), T>::value;

template<IsLambda L>
struct A{
    A(L lam){
        lam();
    }
};
auto lam=+[](){};
auto a=A<Lambda>(lam);



https://www.godbolt.org/z/Pxv95Eb14

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

* [Bug c++/104138] ICE in is_base_type with lambda is passed as parameter with -g
  2022-01-20  4:06 [Bug c++/104138] New: ICE when lambda is passed as parameter nickhuang99 at hotmail dot com
@ 2022-01-20  4:10 ` pinskia at gcc dot gnu.org
  2022-01-20  4:40 ` nickhuang99 at hotmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-20  4:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=93320
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-01-20
             Blocks|                            |54367
            Summary|ICE when lambda is passed   |ICE in is_base_type with
                   |as parameter with -g        |lambda is passed as
                   |                            |parameter with -g
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed related to PR 93320 but not the same as that is invalid code while
this one is valid.


Referenced Bugs:

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

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

* [Bug c++/104138] ICE in is_base_type with lambda is passed as parameter with -g
  2022-01-20  4:06 [Bug c++/104138] New: ICE when lambda is passed as parameter nickhuang99 at hotmail dot com
  2022-01-20  4:10 ` [Bug c++/104138] ICE in is_base_type with lambda is passed as parameter with -g pinskia at gcc dot gnu.org
@ 2022-01-20  4:40 ` nickhuang99 at hotmail dot com
  2022-01-20  4:46 ` pinskia at gcc dot gnu.org
  2024-04-13  8:03 ` [Bug c++/104138] [12 Regression] " pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nickhuang99 at hotmail dot com @ 2022-01-20  4:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from qingzhe huang <nickhuang99 at hotmail dot com> ---
Can we remove the phrase "with -g" from subject because it doesn't require to
compile with "-g" option? This will help for future subject search.

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

* [Bug c++/104138] ICE in is_base_type with lambda is passed as parameter with -g
  2022-01-20  4:06 [Bug c++/104138] New: ICE when lambda is passed as parameter nickhuang99 at hotmail dot com
  2022-01-20  4:10 ` [Bug c++/104138] ICE in is_base_type with lambda is passed as parameter with -g pinskia at gcc dot gnu.org
  2022-01-20  4:40 ` nickhuang99 at hotmail dot com
@ 2022-01-20  4:46 ` pinskia at gcc dot gnu.org
  2024-04-13  8:03 ` [Bug c++/104138] [12 Regression] " pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-20  4:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to qingzhe huang from comment #2)
> Can we remove the phrase "with -g" from subject because it doesn't require
> to compile with "-g" option? This will help for future subject search.

godbot adds an implict -g option which is why you think it does not need it to
get the ICE. You can prove that by adding -g0 and see there is no ICE.

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

* [Bug c++/104138] [12 Regression] ICE in is_base_type with lambda is passed as parameter with -g
  2022-01-20  4:06 [Bug c++/104138] New: ICE when lambda is passed as parameter nickhuang99 at hotmail dot com
                   ` (2 preceding siblings ...)
  2022-01-20  4:46 ` pinskia at gcc dot gnu.org
@ 2024-04-13  8:03 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13  8:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |12.1.0
            Summary|ICE in is_base_type with    |[12 Regression] ICE in
                   |lambda is passed as         |is_base_type with lambda is
                   |parameter with -g           |passed as parameter with -g
   Target Milestone|---                         |12.2
             Status|NEW                         |RESOLVED
      Known to work|                            |11.1.0, 11.4.0, 12.2.0
         Resolution|---                         |DUPLICATE

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 105652 ***

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20  4:06 [Bug c++/104138] New: ICE when lambda is passed as parameter nickhuang99 at hotmail dot com
2022-01-20  4:10 ` [Bug c++/104138] ICE in is_base_type with lambda is passed as parameter with -g pinskia at gcc dot gnu.org
2022-01-20  4:40 ` nickhuang99 at hotmail dot com
2022-01-20  4:46 ` pinskia at gcc dot gnu.org
2024-04-13  8:03 ` [Bug c++/104138] [12 Regression] " 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).