]> granicus.if.org Git - clang/commitdiff
Fix an amusing typo that completely the re-introduction of parameters
authorDouglas Gregor <dgregor@apple.com>
Tue, 2 Mar 2010 01:29:43 +0000 (01:29 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 2 Mar 2010 01:29:43 +0000 (01:29 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97534 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp
test/SemaCXX/local-classes.cpp

index 3619b8e813104e6ac6b8804bbf4e83c7b6b6bc3f..bfb75d2dd3d479c3c7cc6da09e058e6cc009b353 100644 (file)
@@ -1143,7 +1143,7 @@ void Parser::HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo,
         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
index 3c216d0863e205b9961a605dcb1316345e038242..6799e58e954e08bf05a59c6d295b187e0fd44238 100644 (file)
@@ -15,3 +15,18 @@ namespace PR6382 {
     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);
+  }
+}