]> granicus.if.org Git - clang/commitdiff
Fix redundant errors with missing default arguments in member declarations.
authorSebastian Redl <sebastian.redl@getdesigned.at>
Sun, 8 Feb 2009 14:56:26 +0000 (14:56 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Sun, 8 Feb 2009 14:56:26 +0000 (14:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64085 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaCXX/default2.cpp

index f5681af0fa050c3f69e1f78e953b79a3ea7f72bf..c0160b2d423789f1a5d6613735c36d199880e82d 100644 (file)
@@ -1707,8 +1707,11 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
   ProcessDeclAttributes(NewFD, D);
 
   if (getLangOptions().CPlusPlus) {
-    // In C++, check default arguments now that we have merged decls.
-    CheckCXXDefaultArguments(NewFD);
+    // In C++, check default arguments now that we have merged decls. Unless
+    // the lexical context is the class, because in this case this is done
+    // during delayed parsing anyway.
+    if (!CurContext->isRecord())
+      CheckCXXDefaultArguments(NewFD);
 
     // An out-of-line member function declaration must also be a
     // definition (C++ [dcl.meaning]p1).
index 604354b9af2d2089a728a0aeb11777e7e1c01276..f3d726fbeed907f781b53874ae5a73bbc51d90d0 100644 (file)
@@ -1,6 +1,4 @@
 // RUN: clang -fsyntax-only -verify %s
-// XFAIL
-// fails due to exact diagnostic matching
 
 void f(int i, int j, int k = 3);
 void f(int i, int j, int k);
@@ -100,7 +98,7 @@ int Y::mem4(int i = a) // expected-error{{invalid use of nonstatic data member '
 // constructors.
 class Z {
 public:
-  Z(Z&, int i = 17); // expected-note{{candidate function}}
+  Z(Z&, int i = 17); // expected-note 2 {{candidate function}}
 
   void f(Z& z) { 
     Z z2;    // expected-error{{no matching constructor for initialization}}