[cfe-commits] r123894 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CXX/class.derived/class.virtual/p3-0x.cpp
Anders Carlsson
andersca at mac.com
Wed Jan 19 22:33:26 PST 2011
Author: andersca
Date: Thu Jan 20 00:33:26 2011
New Revision: 123894
URL: http://llvm.org/viewvc/llvm-project?rev=123894&view=rev
Log:
When checking for functions marked override, ignore dependent contexts.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CXX/class.derived/class.virtual/p3-0x.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=123894&r1=123893&r2=123894&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jan 20 00:33:26 2011
@@ -858,6 +858,9 @@
if (!MD || !MD->isVirtual())
return;
+ if (MD->isDependentContext())
+ return;
+
// C++0x [class.virtual]p3:
// If a virtual function is marked with the virt-specifier override and does
// not override a member function of a base class,
Modified: cfe/trunk/test/CXX/class.derived/class.virtual/p3-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.derived/class.virtual/p3-0x.cpp?rev=123894&r1=123893&r2=123894&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class.derived/class.virtual/p3-0x.cpp (original)
+++ cfe/trunk/test/CXX/class.derived/class.virtual/p3-0x.cpp Thu Jan 20 00:33:26 2011
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+namespace Test1 {
+
struct B {
virtual void f(int);
};
@@ -8,3 +10,17 @@
virtual void f(long) override; // expected-error {{'f' marked 'override' but does not override any member functions}}
void f(int) override;
};
+}
+
+namespace Test2 {
+
+struct A {
+ virtual void f(int, char, int);
+};
+
+template<typename T>
+struct B : A {
+ virtual void f(T) override;
+};
+
+}
More information about the cfe-commits
mailing list