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 {
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 {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits