[Bug c++/79458] attributes on constructor between class name and parameter list not accepted

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 13 23:12:00 GMT 2017


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The attribute comes before the function name:

$ cat t.C && gcc -S -Wall t.C
struct test {
  __attribute__ ((nonnull)) test (char*);
  [[gnu::nonnull]] test (char*, char*);
};

test a (0);
test b (0, 0);
t.C:6:10: warning: null argument where non-null required (argument 2)
[-Wnonnul]
 test a (0);
          ^
t.C:7:13: warning: null argument where non-null required (argument 2)
[-Wnonnul]
 test b (0, 0);
             ^
t.C:7:13: warning: null argument where non-null required (argument 3)
[-Wnonnul]


More information about the Gcc-bugs mailing list