summaryrefslogtreecommitdiff
path: root/test/SemaCXX/virtual-function-in-union.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/virtual-function-in-union.cpp')
-rw-r--r--test/SemaCXX/virtual-function-in-union.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/SemaCXX/virtual-function-in-union.cpp b/test/SemaCXX/virtual-function-in-union.cpp
new file mode 100644
index 000000000000..0c4ba5d32caa
--- /dev/null
+++ b/test/SemaCXX/virtual-function-in-union.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+union x {
+ virtual void f(); // expected-error {{unions cannot have virtual functions}}
+};