mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 23:16:06 +00:00

Fixes the following bug: namespace Name { int __attribute((target_version("default"))) foo() { return 0; } } namespace Name { int __attribute((target_version("sve"))) foo() { return 1; } } int bar() { return Name::foo(); } error: redefinition of 'foo' int __attribute((target_version("sve"))) foo() { return 1; } note: previous definition is here int __attribute((target_version("default"))) foo() { return 0; } While fixing this I also found that in the absence of default version declaration, the one we implicitly create has incorrect mangling if we are in a namespace: namespace OtherName { int __attribute((target_version("sve"))) foo() { return 2; } } int baz() { return OtherName::foo(); } In this example instead of creating a declaration for the symbol @_ZN9OtherName3fooEv.default we are creating one for the symbol @_Z3foov.default (the namespace mangling prefix is omitted). This has now been fixed.
13 lines
299 B
C++
13 lines
299 B
C++
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify %s
|
|
// expected-no-diagnostics
|
|
|
|
namespace Name {
|
|
int __attribute((target_version("default"))) foo() { return 0; }
|
|
}
|
|
|
|
namespace Name {
|
|
int __attribute((target_version("sve"))) foo() { return 1; }
|
|
}
|
|
|
|
int bar() { return Name::foo(); }
|