[LLVMbugs] [Bug 8901] New: Attribute mode rejected for enum types.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 4 06:29:19 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=8901

           Summary: Attribute mode rejected for enum types.
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: zaffanella at cs.unipr.it
                CC: llvmbugs at cs.uiuc.edu


gcc allows mode attribute to be applied to (a declaration of) an enumerated
type:

typedef enum { a, b } E __attribute__((__mode__(__QI__)));

clang rejects the code above with the following message:

error: mode attribute only supported for integer and floating-point types
typedef enum { a, b } E __attribute__((__mode__(__QI__)));

In C99 (6.2.5 p17) an enumerated type is an integer type.


Also note that gcc allows for the mode attribute to be directly specified on
the enumeration type declaration (i.e., not necessarily through a typedef
declaration). Namely, the following variants are accepted too:

enum __attribute__((__mode__(__QI__))) E { a, b };

typedef enum __attribute__((__mode__(__QI__))) { a, b } E;

clang instead complains as follows:

error: 'mode' attribute invalid on this declaration, requires typedef or value
typedef enum __attribute__((__mode__(__QI__))) { a, b } E;
        ^                   ~~~~~~~~

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list