Skip to content

[Clang] Clang accepts NonIdentifier string in the gnu::abi_tag attribute #168901

@da-viper

Description

@da-viper
// main.cpp 

[[gnu::abi_tag("[[something]]")]]
int get_int() { 
	return 0;
}

int main() { 
	int ret = get_int();
	return 0;
}

with g++

$>  g++ test.cpp
test.cpp:3:13: error: arguments to the ‘abi_tag’ attribute must contain valid identifiers
    3 | int get_int() {
      |             ^
test.cpp:3:13: note: ‘[’ is not a valid first character for an identifier

with clang (this should be an error). As I assume we need to match gcc as it is a gnu extension

$>  clang++ test.cpp
$>

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueduplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions