Skip to content

Compiler error when using "_Generic" identifier in C++ source code #11633

@llvmbot

Description

@llvmbot
Bugzilla Link 11261
Resolution WONTFIX
Resolved on Oct 28, 2011 18:01
Version trunk
OS MacOS X
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

When compiling code with clang++ 3.0 (as shipped with Apple XCode 4.2) that contains _Generic, an error is raised, like this:

test.cc:5:6: error: expected unqualified-id
int _Generic = 0;

After some googling around, this seems to be related to the "C1X generic selections" extension (see http://clang.llvm.org/doxygen/classclang_1_1GenericSelectionExpr.html). However, I could not find further information on this, and it is not clear to me whether this is part of C++11, or of a future extension of the C++ standard.

If this error really is intentional behavior, then please change the warning to something more helpful, like "_Generic is a C1X reserved keyword".

But personally I'd prefer if using _Generic was again made possible for code that does not explicitly request C1X extensions, as "legacy code" is using this.

For reference, this was with
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.8.0
Thread model: posix

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++wontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions