1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 union U {
4   int d;
5   virtual int f() { return d; }; // expected-error {{unions cannot have virtual functions}}
6 };
7 
8 int foo() { U u; return u.d; }
9