[cfe-commits] r97534 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/SemaCXX/local-classes.cpp

Douglas Gregor dgregor at apple.com
Mon Mar 1 17:29:43 PST 2010


Author: dgregor
Date: Mon Mar  1 19:29:43 2010
New Revision: 97534

URL: http://llvm.org/viewvc/llvm-project?rev=97534&view=rev
Log:
Fix an amusing typo that completely the re-introduction of parameters
for the purposes of parsing default arguments. In effect, we would
re-introduce the parameter with a default argument N times (where N is
the number of parameters preceding the parameter with a default
argument). This showed up when a defaulted parameter of a member
function of a local class shadowed a parameter of the enclosing
function. Fixes PR6383.


Modified:
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/test/SemaCXX/local-classes.cpp

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=97534&r1=97533&r2=97534&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Mar  1 19:29:43 2010
@@ -1143,7 +1143,7 @@
         LateMethod->DefaultArgs.reserve(FTI.NumArgs);
         for (unsigned I = 0; I < ParamIdx; ++I)
           LateMethod->DefaultArgs.push_back(
-                    LateParsedDefaultArgument(FTI.ArgInfo[ParamIdx].Param));
+                             LateParsedDefaultArgument(FTI.ArgInfo[I].Param));
       }
 
       // Add this parameter to the list of parameters (it or may

Modified: cfe/trunk/test/SemaCXX/local-classes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/local-classes.cpp?rev=97534&r1=97533&r2=97534&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/local-classes.cpp (original)
+++ cfe/trunk/test/SemaCXX/local-classes.cpp Mon Mar  1 19:29:43 2010
@@ -15,3 +15,18 @@
     return -1;
   }
 }
+
+namespace PR6383 {
+  void test (bool gross)
+  {
+    struct compare_and_set
+    {
+      void operator() (const bool inner, const bool gross = false)
+      {
+        // the code
+      }
+    } compare_and_set2;
+
+    compare_and_set2 (false, gross);
+  }
+}





More information about the cfe-commits mailing list