Skip to content

clang weird diagnostic for wrong enums! #11354

@bcardosolopes

Description

@bcardosolopes
Bugzilla Link 10982
Resolution FIXED
Resolved on Jan 13, 2014 10:44
Version trunk
OS All
CC @spavloff

Extended Description

Given the following code:

#include <stdio.h>

enum {
3DNowShift = 0,
XXX = 1
};

int main() {
printf("%d\n", XXX);
return 0;
}

Instead of clang reporting that a enum can't start with a number or something like that, it points "{}" matching error:

$ clang /tmp/bug.c -c
/tmp/bug.c:4:3: error: expected '}'
3DNowShift = 0,
^
/tmp/bug.c:3:6: note: to match this '{'
enum {
^
/tmp/bug.c:9:18: error: use of undeclared identifier 'XXX'
printf("%d\n", XXX);
^
2 errors generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions