[PATCH] Better diagnostic for static function overriding thiscall virtual method
Hans Wennborg
hans at chromium.org
Tue Dec 10 17:13:23 PST 2013
New version of the patch that simply suppresses the cc-mismatch error in favour of the existing static-override error, as discussed on the email thread.
Richard: what do you think?
Hi rafael, rnk,
http://llvm-reviews.chandlerc.com/D2375
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2375?vs=6012&id=6015#toc
Files:
lib/Sema/SemaDeclCXX.cpp
test/SemaCXX/virtual-override.cpp
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -12058,6 +12058,12 @@
if (NewCC == OldCC)
return false;
+ // If the calling conventions mismatch because the new function is static,
+ // suppress the calling convention mismatch error; the error about static
+ // function override is more clear.
+ if (New->getStorageClass() == SC_Static)
+ return false;
+
Diag(New->getLocation(),
diag::err_conflicting_overriding_cc_attributes)
<< New->getDeclName() << New->getType() << Old->getType();
Index: test/SemaCXX/virtual-override.cpp
===================================================================
--- test/SemaCXX/virtual-override.cpp
+++ test/SemaCXX/virtual-override.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+// RUN: %clang_cc1 -fsyntax-only -cxx-abi itanium -verify %s -std=c++11
+// RUN: %clang_cc1 -fsyntax-only -cxx-abi microsoft -verify %s -std=c++11
namespace T1 {
class A {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2375.2.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131210/86411915/attachment.bin>
More information about the cfe-commits
mailing list