mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 15:46:44 +00:00

Clang used to silently ignore __declspec(novtable). It is implemented now, but leaving the vtable uninitialized does not work when using the Itanium ABI, where the class layout for complex class hierarchies is stored in the vtable. It might be possible to honor the novtable attribute in some simple cases and either report an error or ignore it in more complex situations, but it’s not clear if that would be worthwhile. There is also value in having a simple and predictable behavior, so this changes clang to simply ignore novtable when not using the Microsoft C++ ABI. llvm-svn: 242730
8 lines
572 B
C++
8 lines
572 B
C++
// RUN: %clang_cc1 -triple i386-pc-win32 %s -fsyntax-only -verify -fms-extensions -Wno-microsoft -std=c++11
|
|
|
|
struct __declspec(novtable) S {};
|
|
enum __declspec(novtable) E {}; // expected-warning{{'novtable' attribute only applies to classes}}
|
|
int __declspec(novtable) I; // expected-warning{{'novtable' attribute only applies to classes}}
|
|
typedef struct T __declspec(novtable) U; // expected-warning{{'novtable' attribute only applies to classes}}
|
|
auto z = []() __declspec(novtable) { return nullptr; }; // expected-warning{{'novtable' attribute only applies to classes}}
|