https://issues.dlang.org/show_bug.cgi?id=22666

          Issue ID: 22666
           Summary: ImportC: Error: attributes should be specified before
                    the function definition
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

The system framework CoreFoundation on macOS has a header file that declares
the following function:

typedef unsigned long CFOptionFlags;
typedef signed long CFIndex;

static inline __attribute__((always_inline)) 
CFOptionFlags CFUserNotificationCheckBoxChecked(CFIndex i)
__attribute__((availability(macos,introduced=10.0)))
__attribute__((availability(ios,unavailable)))
__attribute__((availability(watchos,unavailable)))
__attribute__((availability(tvos,unavailable))) 
{
    return ((CFOptionFlags)(1UL << (8 + i)));
}

It fails with the following error message:

Error: attributes should be specified before the function
 definition

Apparently clang allows attributes in this position (after the parameter list),
but gcc does not.

--

Reply via email to