public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99571] New: ICE for NTTP with pointer to array of union
@ 2021-03-13  4:17 johelegp at gmail dot com
  2021-03-15 17:33 ` [Bug c++/99571] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: johelegp at gmail dot com @ 2021-03-13  4:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99571
           Summary: ICE for NTTP with pointer to array of union
           Product: gcc
           Version: 11.0
               URL: https://godbolt.org/z/rsc6fs
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/rsc6fs.
```C++
struct I{
  union { int a[1]{}; };
  int*i=a;
};
constexpr I i;
template<auto>struct C{};
[[maybe_unused]]C<i>c;
```

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

* [Bug c++/99571] ICE for NTTP with pointer to array of union
  2021-03-13  4:17 [Bug c++/99571] New: ICE for NTTP with pointer to array of union johelegp at gmail dot com
@ 2021-03-15 17:33 ` mpolacek at gcc dot gnu.org
  2022-01-19  3:03 ` [Bug c++/99571] ICE for NTTP with pointer to a field inside anonymous union/struct pinskia at gcc dot gnu.org
  2022-01-19 13:01 ` johelegp at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-15 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-03-15
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  ICE started with r11-2237.  Before that:

error: ‘& i.I::<anonymous>.I::<unnamed union>::a’ is not a valid template
argument of type ‘int*’ because ‘i.I::<anonymous>.I::<unnamed union>::a’ is not
a variable
    7 | [[maybe_unused]]C<i>c;
      |                    ^

Not sure if we should treat this as a regression.

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

* [Bug c++/99571] ICE for NTTP with pointer to a field inside anonymous union/struct
  2021-03-13  4:17 [Bug c++/99571] New: ICE for NTTP with pointer to array of union johelegp at gmail dot com
  2021-03-15 17:33 ` [Bug c++/99571] " mpolacek at gcc dot gnu.org
@ 2022-01-19  3:03 ` pinskia at gcc dot gnu.org
  2022-01-19 13:01 ` johelegp at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-19  3:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|https://godbolt.org/z/rsc6f |
                   |s                           |
            Summary|ICE for NTTP with pointer   |ICE for NTTP with pointer
                   |to array of union           |to a field inside anonymous
                   |                            |union/struct

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://godbolt.org/z/rsc6fs

Here is another testcase which shows a similar issue:
struct I{
  union { int a{}; };
  int *i;
  constexpr I():i(&a){}
};
constexpr I i;
template<I>struct C{};
[[maybe_unused]]C<i>c;

---- CUT ----
Note clang has a bogus warning for the above about the anonymous union (I am
not going to file a bug about it though).

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

* [Bug c++/99571] ICE for NTTP with pointer to a field inside anonymous union/struct
  2021-03-13  4:17 [Bug c++/99571] New: ICE for NTTP with pointer to array of union johelegp at gmail dot com
  2021-03-15 17:33 ` [Bug c++/99571] " mpolacek at gcc dot gnu.org
  2022-01-19  3:03 ` [Bug c++/99571] ICE for NTTP with pointer to a field inside anonymous union/struct pinskia at gcc dot gnu.org
@ 2022-01-19 13:01 ` johelegp at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: johelegp at gmail dot com @ 2022-01-19 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
> Here is another testcase which shows a similar issue:

Here's its link: https://godbolt.org/z/fMbYMMYKz. You posted the Comment 0's.

> Note clang has a bogus warning for the above about the anonymous union (I am not going to file a bug about it though).

Opened https://github.com/llvm/llvm-project/issues/53296 for that.

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

end of thread, other threads:[~2022-01-19 13:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-13  4:17 [Bug c++/99571] New: ICE for NTTP with pointer to array of union johelegp at gmail dot com
2021-03-15 17:33 ` [Bug c++/99571] " mpolacek at gcc dot gnu.org
2022-01-19  3:03 ` [Bug c++/99571] ICE for NTTP with pointer to a field inside anonymous union/struct pinskia at gcc dot gnu.org
2022-01-19 13:01 ` johelegp at gmail 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).