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

            Bug ID: 70365
           Summary: warn_unused_result doesn't warn when the result is a
                    class with a destructor
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jpetri at izotope dot com
  Target Milestone: ---

The __attribute__((warn_unused_result)) doesn't warn when the function result
is a class with a destructor.

struct Error {
~Error();
};

__attribute__((warn_unused_result)) Error test();

int main()
{
    test();
    return 0;
}

Compile as follows:
$ g++ -c test.c
[I get no output, just success.]

System info:
g++ version: g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Ubuntu 15.10, stock distro g++

Also repros on:
http://gcc.godbolt.org/ GCC 6 snapshot, and GCC 5.3.0

Reply via email to