From 5870373d19547b3e05bc1ec1df3b534d999e1d82 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Sat, 21 Feb 2015 01:07:24 +0000 Subject: Improve diagnostic when failing to synthesize implicit member due to dllexport (PR22591) This is only a problem in C++03 mode targeting MS ABI (MinGW doesn't export inline methods, and C++11 marks these methods implicitly deleted). Since targeting the MS ABI in pre-C++11 mode is a rare configuration, this will probably not get fixed, but we can at least have a better error message. llvm-svn: 230115 --- clang/lib/Sema/SemaDeclCXX.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/Sema/SemaDeclCXX.cpp') diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 33f8c91691f..4d2e87798fb 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -4821,7 +4821,13 @@ static void checkDLLAttribute(Sema &S, CXXRecordDecl *Class) { // defaulted methods, and the copy and move assignment operators. The // latter are exported even if they are trivial, because the address of // an operator can be taken and should compare equal accross libraries. + DiagnosticErrorTrap Trap(S.Diags); S.MarkFunctionReferenced(Class->getLocation(), MD); + if (Trap.hasErrorOccurred()) { + S.Diag(ClassAttr->getLocation(), diag::note_due_to_dllexported_class) + << Class->getName() << !S.getLangOpts().CPlusPlus11; + break; + } // There is no later point when we will see the definition of this // function, so pass it to the consumer now. -- cgit v1.2.3