summaryrefslogtreecommitdiff
path: root/test/SemaCXX/attr-gnu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/attr-gnu.cpp')
-rw-r--r--test/SemaCXX/attr-gnu.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/SemaCXX/attr-gnu.cpp b/test/SemaCXX/attr-gnu.cpp
index b4e9f4609f675..a553f0d210003 100644
--- a/test/SemaCXX/attr-gnu.cpp
+++ b/test/SemaCXX/attr-gnu.cpp
@@ -27,3 +27,19 @@ public:
void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not known to GCC.
};
}
+
+template<typename T>
+union Tu { T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+template<typename T>
+union Tu2 { int x; T b; } __attribute__((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+union Tu3 { int x; } __attribute((transparent_union)); // expected-warning {{'transparent_union' attribute ignored}}
+
+void tuTest1(Tu<int> u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu<int>' for 1st argument}}
+void tuTest2(Tu3 u); // expected-note {{candidate function not viable: no known conversion from 'int' to 'Tu3' for 1st argument}}
+void tu() {
+ int x = 2;
+ tuTest1(x); // expected-error {{no matching function for call to 'tuTest1'}}
+ tuTest2(x); // expected-error {{no matching function for call to 'tuTest2'}}
+}