[cfe-commits] r64085 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/default2.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Sun Feb 8 06:56:34 PST 2009


Author: cornedbee
Date: Sun Feb  8 08:56:26 2009
New Revision: 64085

URL: http://llvm.org/viewvc/llvm-project?rev=64085&view=rev
Log:
Fix redundant errors with missing default arguments in member declarations.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaCXX/default2.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=64085&r1=64084&r2=64085&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Feb  8 08:56:26 2009
@@ -1707,8 +1707,11 @@
   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).

Modified: cfe/trunk/test/SemaCXX/default2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/default2.cpp?rev=64085&r1=64084&r2=64085&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/default2.cpp (original)
+++ cfe/trunk/test/SemaCXX/default2.cpp Sun Feb  8 08:56:26 2009
@@ -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 @@
 // 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}}





More information about the cfe-commits mailing list