public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100210] New: [[nodiscard]] constructor causes warning on arm-linux-gnueabihf
@ 2021-04-22 13:12 georg.schwab at emocean dot io
  2021-04-22 17:15 ` [Bug c++/100210] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: georg.schwab at emocean dot io @ 2021-04-22 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100210
           Summary: [[nodiscard]] constructor causes warning on
                    arm-linux-gnueabihf
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: georg.schwab at emocean dot io
  Target Milestone: ---
            Target: arm-linux-gnueabihf

Created attachment 50655
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50655&action=edit
offending code

The code below causes a warning under arm-linux-gnueabihf when using
-Wunused-result. Under x86_64-linux-gnu and aarch64-linux-gnu, the code
compiles without warnings.

(Tested on Ubuntu 20.04.1 LTS for x86_64)

Offending Code:
===============

struct X
{
   [[nodiscard]] X(int);
};

void t()
{
   X x(0);
}

Command Line and Output:
========================

$ arm-linux-gnueabihf-g++-10 -c -Wunused-result nodiscard-constructor.cpp
nodiscard-constructor.cpp: In function ‘void t()’:
nodiscard-constructor.cpp:8:7: warning: ignoring return value of ‘X::X(int)’,
declared with attribute ‘nodiscard’ [-Wunused-result]
    8 |  X x(0);
      |       ^
nodiscard-constructor.cpp:3:16: note: declared here
    3 |  [[nodiscard]] X(int);
      |                ^
nodiscard-constructor.cpp:8:7: warning: ignoring return value of ‘X::X(int)’,
declared with attribute ‘nodiscard’ [-Wunused-result]
    8 |  X x(0);
      |       ^
nodiscard-constructor.cpp:3:16: note: declared here
    3 |  [[nodiscard]] X(int);
      |

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

* [Bug c++/100210] [[nodiscard]] constructor causes warning on arm-linux-gnueabihf
  2021-04-22 13:12 [Bug c++/100210] New: [[nodiscard]] constructor causes warning on arm-linux-gnueabihf georg.schwab at emocean dot io
@ 2021-04-22 17:15 ` mpolacek at gcc dot gnu.org
  2021-04-22 17:19 ` mpolacek at gcc dot gnu.org
  2021-04-23 12:37 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-22 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Can't reproduce, I think it has been fixed by r11-7512.

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

* [Bug c++/100210] [[nodiscard]] constructor causes warning on arm-linux-gnueabihf
  2021-04-22 13:12 [Bug c++/100210] New: [[nodiscard]] constructor causes warning on arm-linux-gnueabihf georg.schwab at emocean dot io
  2021-04-22 17:15 ` [Bug c++/100210] " mpolacek at gcc dot gnu.org
@ 2021-04-22 17:19 ` mpolacek at gcc dot gnu.org
  2021-04-23 12:37 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-22 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yes, verified that when reverting that change the warning shows up.  Thus,
fixed.

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

* [Bug c++/100210] [[nodiscard]] constructor causes warning on arm-linux-gnueabihf
  2021-04-22 13:12 [Bug c++/100210] New: [[nodiscard]] constructor causes warning on arm-linux-gnueabihf georg.schwab at emocean dot io
  2021-04-22 17:15 ` [Bug c++/100210] " mpolacek at gcc dot gnu.org
  2021-04-22 17:19 ` mpolacek at gcc dot gnu.org
@ 2021-04-23 12:37 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-23 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Closing as dup.

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

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

end of thread, other threads:[~2021-04-23 12:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 13:12 [Bug c++/100210] New: [[nodiscard]] constructor causes warning on arm-linux-gnueabihf georg.schwab at emocean dot io
2021-04-22 17:15 ` [Bug c++/100210] " mpolacek at gcc dot gnu.org
2021-04-22 17:19 ` mpolacek at gcc dot gnu.org
2021-04-23 12:37 ` jakub 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).