[llvm-bugs] [Bug 48672] New: Block scope function declaration with implicit int + GNU attribute

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 5 15:13:22 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48672

            Bug ID: 48672
           Summary: Block scope function declaration with implicit int +
                    GNU attribute
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aaron at aaronballman.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

In the following in C89 mode, h() is treated as a function declaration with an
implicit int return type in GCC, but is rejected by Clang as an invalid
declaration:

```
__attribute__(()) g(); // Accepted by both Clang and GCC

void func(void) {
  __attribute__(()) h(); // Rejected by Clang, accepted by GCC
  __attribute__(()) extern i(); // Accepted by both Clang and GCC
  j(); // Function call expr to an implicitly-declared function j() in
       // both Clang and GCC.
}
```
GCC and Clang both use the presence of a GNU-style attribute to signal that
what follows is a declaration, but it seems that Clang's handling requires some
kind of declaration specifier (like the `extern` keyword) to get this correct
at block scope.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210105/376fb260/attachment-0001.html>


More information about the llvm-bugs mailing list