diff options
| author | Hans Wennborg <hans@hanshq.net> | 2019-08-01 08:01:09 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2019-08-01 08:01:09 +0000 |
| commit | c5877e9803b1b4515ba8bfb2a83e974938feb283 (patch) | |
| tree | 90f4c63899dbb3364f9d118655ae796bdb7d014a /clang/test/CodeGenCXX | |
| parent | 4f1d893f9ec33a493d9f35426254a0ce69716933 (diff) | |
| download | bcm5719-llvm-c5877e9803b1b4515ba8bfb2a83e974938feb283.tar.gz bcm5719-llvm-c5877e9803b1b4515ba8bfb2a83e974938feb283.zip | |
Delay emitting dllexport explicitly defaulted members until the class is fully parsed (PR40006)
This is similar to r245139, but that only addressed dllexported classes.
It was still possible to run into the same problem with dllexported
members in an otherwise normal class (see bug). This uses the same
strategy to fix: delay defining the method until the whole class has
been parsed.
(The easiest way to see the ordering problem is in
Parser::ParseCXXMemberSpecification(): it calls
ParseLexedMemberInitializers() *after* ActOnFinishCXXMemberDecls(),
which was trying to define the dllexport method. Now we delay it to
ActOnFinishCXXNonNestedClass() which is called after both of those.)
Differential revision: https://reviews.llvm.org/D65511
llvm-svn: 367520
Diffstat (limited to 'clang/test/CodeGenCXX')
| -rw-r--r-- | clang/test/CodeGenCXX/dllexport.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/dllexport.cpp b/clang/test/CodeGenCXX/dllexport.cpp index 16cfb846584..5d4523f2ea6 100644 --- a/clang/test/CodeGenCXX/dllexport.cpp +++ b/clang/test/CodeGenCXX/dllexport.cpp @@ -851,6 +851,15 @@ struct __declspec(dllexport) Baz { // Baz's operator=, causing instantiation of Foo<int> after which // ActOnFinishCXXNonNestedClass is called, and we would bite our own tail. // M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc dereferenceable(1) %"struct.InClassInits::Baz"* @"??4Baz@InClassInits@@QAEAAU01@ABU01@@Z" + +// Trying to define the explicitly defaulted ctor must be delayed until the +// in-class initializer for x has been processed. +struct PR40006 { + __declspec(dllexport) PR40006() = default; + int x = 42; +}; +// M32-DAG: define weak_odr dso_local dllexport x86_thiscallcc %"struct.InClassInits::PR40006"* @"??0PR40006@InClassInits@@QAE@XZ" + } // We had an issue where instantiating A would force emission of B's delayed |

