public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/85973] [[nodiscard]] shall emit a warning for unused anonymous variable
       [not found] <bug-85973-4@http.gcc.gnu.org/bugzilla/>
@ 2023-03-21 15:32 ` pinskia at gcc dot gnu.org
  2023-03-21 15:32 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-21 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johelegp at gmail dot com

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 95454 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85973] [[nodiscard]] shall emit a warning for unused anonymous variable
       [not found] <bug-85973-4@http.gcc.gnu.org/bugzilla/>
  2023-03-21 15:32 ` [Bug c++/85973] [[nodiscard]] shall emit a warning for unused anonymous variable pinskia at gcc dot gnu.org
@ 2023-03-21 15:32 ` pinskia at gcc dot gnu.org
  2023-03-21 15:33 ` [Bug c++/85973] [[nodiscard]] on class " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-21 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tejo@bang-olufsen.dk

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 109235 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85973] [[nodiscard]] on class shall emit a warning for unused anonymous variable
       [not found] <bug-85973-4@http.gcc.gnu.org/bugzilla/>
  2023-03-21 15:32 ` [Bug c++/85973] [[nodiscard]] shall emit a warning for unused anonymous variable pinskia at gcc dot gnu.org
  2023-03-21 15:32 ` pinskia at gcc dot gnu.org
@ 2023-03-21 15:33 ` pinskia at gcc dot gnu.org
  2024-02-29 17:33 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-21 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-03-21
     Ever confirmed|0                           |1
            Summary|[[nodiscard]] shall emit a  |[[nodiscard]] on class
                   |warning for unused          |shall emit a warning for
                   |anonymous variable          |unused anonymous variable
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
struct [[nodiscard]] scope_exit {
        scope_exit(int);
};


int main()
{
    scope_exit{0};
}
```

Note if we move the attribute to the constructor, then GCC will error out.

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

* [Bug c++/85973] [[nodiscard]] on class shall emit a warning for unused anonymous variable
       [not found] <bug-85973-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-03-21 15:33 ` [Bug c++/85973] [[nodiscard]] on class " pinskia at gcc dot gnu.org
@ 2024-02-29 17:33 ` mpolacek at gcc dot gnu.org
  2024-08-27  0:28 ` pinskia at gcc dot gnu.org
  2024-08-27 10:23 ` leonid.satanovsky at gmail dot com
  5 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-02-29 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tiagomacarios at gmail dot com

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 98520 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85973] [[nodiscard]] on class shall emit a warning for unused anonymous variable
       [not found] <bug-85973-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2024-02-29 17:33 ` mpolacek at gcc dot gnu.org
@ 2024-08-27  0:28 ` pinskia at gcc dot gnu.org
  2024-08-27 10:23 ` leonid.satanovsky at gmail dot com
  5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-27  0:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |leonid.satanovsky at gmail dot com

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 116441 has been marked as a duplicate of this bug. ***

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

* [Bug c++/85973] [[nodiscard]] on class shall emit a warning for unused anonymous variable
       [not found] <bug-85973-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2024-08-27  0:28 ` pinskia at gcc dot gnu.org
@ 2024-08-27 10:23 ` leonid.satanovsky at gmail dot com
  5 siblings, 0 replies; 6+ messages in thread
From: leonid.satanovsky at gmail dot com @ 2024-08-27 10:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Leonid Satanovsky <leonid.satanovsky at gmail dot com> ---
As you are marking other bugs as duplicates of the current bug, please don't
forget to transfer the useful test cases not mentioned in current bug (e.g.
GccFailedNoDiscard2 case seen below):

struct [[nodiscard]] GccFailedNoDiscard1 {};
struct GccFailedNoDiscard2 { [[nodiscard]] GccFailedNoDiscard2() = default;};
template<class T> struct [[nodiscard]] GccFailedNoDiscard3 {};

struct GccOKNoDiscard1 { [[nodiscard]] GccOKNoDiscard1() {}};
template<class T> struct GccOKNoDiscard2 {
    [[nodiscard]] GccOKNoDiscard2() {}};

int main() {
    GccFailedNoDiscard1 {};
    GccFailedNoDiscard2 {};
    GccFailedNoDiscard3<void> {};
    GccOKNoDiscard1 {};
    GccOKNoDiscard2<void> {};
}

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

end of thread, other threads:[~2024-08-27 10:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-85973-4@http.gcc.gnu.org/bugzilla/>
2023-03-21 15:32 ` [Bug c++/85973] [[nodiscard]] shall emit a warning for unused anonymous variable pinskia at gcc dot gnu.org
2023-03-21 15:32 ` pinskia at gcc dot gnu.org
2023-03-21 15:33 ` [Bug c++/85973] [[nodiscard]] on class " pinskia at gcc dot gnu.org
2024-02-29 17:33 ` mpolacek at gcc dot gnu.org
2024-08-27  0:28 ` pinskia at gcc dot gnu.org
2024-08-27 10:23 ` leonid.satanovsky 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).