public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108587] New: `decltype(x) x;` in struct declaration causes "changes meaning of" error
@ 2023-01-29  2:57 mserdarsanli at gmail dot com
  2023-01-29  3:01 ` [Bug c++/108587] " pinskia at gcc dot gnu.org
  2023-01-29  3:04 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: mserdarsanli at gmail dot com @ 2023-01-29  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108587
           Summary: `decltype(x) x;` in struct declaration causes "changes
                    meaning of" error
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mserdarsanli at gmail dot com
  Target Milestone: ---

Godbolt link: https://godbolt.org/z/rjEGPKcE7


void fine() {
    int x;

    struct {
        int x;
    } v = {
        .x = x,
    };
}

void not_fine() {
    int x;

    struct {
        decltype(x) x; // error: declaration of 'int not_fine()::<unnamed
struct>::x' changes meaning of 'x' [-fpermissive]
    } v = {
        .x = x,
    };
}

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

* [Bug c++/108587] `decltype(x) x;` in struct declaration causes "changes meaning of" error
  2023-01-29  2:57 [Bug c++/108587] New: `decltype(x) x;` in struct declaration causes "changes meaning of" error mserdarsanli at gmail dot com
@ 2023-01-29  3:01 ` pinskia at gcc dot gnu.org
  2023-01-29  3:04 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-29  3:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes and gcc is correct here.
Even if you did:
typedef int t;
struct s{
  typedef t t;
};

This code is illform but no diagnostic is required. Gcc is one of the few
compilers which does the diagnostic for it.

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

* [Bug c++/108587] `decltype(x) x;` in struct declaration causes "changes meaning of" error
  2023-01-29  2:57 [Bug c++/108587] New: `decltype(x) x;` in struct declaration causes "changes meaning of" error mserdarsanli at gmail dot com
  2023-01-29  3:01 ` [Bug c++/108587] " pinskia at gcc dot gnu.org
@ 2023-01-29  3:04 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-29  3:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |DUPLICATE

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 82193

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

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

end of thread, other threads:[~2023-01-29  3:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29  2:57 [Bug c++/108587] New: `decltype(x) x;` in struct declaration causes "changes meaning of" error mserdarsanli at gmail dot com
2023-01-29  3:01 ` [Bug c++/108587] " pinskia at gcc dot gnu.org
2023-01-29  3:04 ` 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).