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

            Bug ID: 122428
           Summary: Missing nocf_check attribute diagnostic
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: sjames at gcc dot gnu.org
  Target Milestone: ---

[hjl@gnu-tgl-3 pr122427]$ cat y.c
extern void foo (void) __attribute__((nocf_check));
extern void foo (void);
extern void bar (void);
extern void bar (void) __attribute__((nocf_check));
[hjl@gnu-tgl-3 pr122427]$ g++ -S -fcf-protection y.c
y.c:4:13: error: ambiguating new declaration of ‘void bar()’
    4 | extern void bar (void) __attribute__((nocf_check));
      |             ^~~
y.c:3:13: note: old declaration ‘void bar()’
    3 | extern void bar (void);
      |             ^~~
[hjl@gnu-tgl-3 pr122427]$ 

Since __attribute__((nocf_check)) changes function type, should the C++
front issue an error for

extern void foo (void) __attribute__((nocf_check));
extern void foo (void);

Reply via email to