mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 01:36:06 +00:00

Currently, this is only diagnosed but the decl is not marked invalid. This may hit assertions down the path. This also reverts the fix for PR49534 since it is not needed anymore. Reviewed By: hubert.reinterpretcast Differential Revision: https://reviews.llvm.org/D113145
9 lines
191 B
C++
9 lines
191 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
union U {
|
|
int d;
|
|
virtual int f() { return d; }; // expected-error {{unions cannot have virtual functions}}
|
|
};
|
|
|
|
int foo() { U u; return u.d; }
|