diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-02 01:29:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-02 01:29:43 +0000 |
commit | 1d85d2903b07e036f16e2f73f6eda89bdf50712c (patch) | |
tree | 120163d6a97c799cec66ef2a35a0ad3a6e5f4fc3 | |
parent | d0fa304dc7b6dbc1496e812f1763cd4506d3bebf (diff) | |
download | bcm5719-llvm-1d85d2903b07e036f16e2f73f6eda89bdf50712c.tar.gz bcm5719-llvm-1d85d2903b07e036f16e2f73f6eda89bdf50712c.zip |
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.
llvm-svn: 97534
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/local-classes.cpp | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 3619b8e8131..bfb75d2dd3d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -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 diff --git a/clang/test/SemaCXX/local-classes.cpp b/clang/test/SemaCXX/local-classes.cpp index 3c216d0863e..6799e58e954 100644 --- a/clang/test/SemaCXX/local-classes.cpp +++ b/clang/test/SemaCXX/local-classes.cpp @@ -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); + } +} |