diff options
author | Erich Keane <erich.keane@intel.com> | 2019-06-21 22:29:32 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2019-06-21 22:29:32 +0000 |
commit | 36176249d136a7ac562e7f1d030ff8dbf943d52b (patch) | |
tree | 0e55b21850d3359a9d65d859c0acf6f5dd44e081 /clang/test/CodeGenCXX/target-features-error.cpp | |
parent | fa52674ac08f6923f17a30aae04ea1d3412dc2ba (diff) | |
download | bcm5719-llvm-36176249d136a7ac562e7f1d030ff8dbf943d52b.tar.gz bcm5719-llvm-36176249d136a7ac562e7f1d030ff8dbf943d52b.zip |
Ensure Target Features always_inline error happens in C++ cases.
A handful of C++ cases as reported in PR42352 didn't actually give an
error when always_inlining with a different target feature list. This
resulted in broken IR.
llvm-svn: 364109
Diffstat (limited to 'clang/test/CodeGenCXX/target-features-error.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/target-features-error.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/target-features-error.cpp b/clang/test/CodeGenCXX/target-features-error.cpp new file mode 100644 index 00000000000..44179deaf35 --- /dev/null +++ b/clang/test/CodeGenCXX/target-features-error.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - + +struct S { + __attribute__((always_inline, target("avx512f"))) + void foo(){} + __attribute__((always_inline, target("avx512f"))) + operator int(){ return 0; } + __attribute__((always_inline, target("avx512f"))) + void operator()(){ } + +}; + +void usage(S & s) { + s.foo(); // expected-error {{'foo' requires target feature 'avx512f'}} + (void)(int)s; // expected-error {{'operator int' requires target feature 'avx512f'}} + s(); // expected-error {{'operator()' requires target feature 'avx512f'}} +} |