PR23029 / C++ DR2233: Allow expanded parameter packs to follow
authorRichard Smith <richard@metafoo.co.uk>
Tue, 2 Jun 2020 17:42:36 +0000 (10:42 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Tue, 2 Jun 2020 20:48:59 +0000 (13:48 -0700)
commitb5f2c4e45b8d54063051e6955cef0bbb7b6ab0f8
treeb83adaeef6614dfac500404053a952ea231b55ac
parentaf86a10bad28d1829370bfa9b8b7bb9302f637d2
PR23029 / C++ DR2233: Allow expanded parameter packs to follow
parameters with default arguments.

Directly follow the wording by relaxing the AST invariant that all
parameters after one with a default arguemnt also have default
arguments, and removing the diagnostic on missing default arguments
on a pack-expanded parameter following a parameter with a default
argument.

Testing also revealed that we need to special-case explicit
specializations of templates with a pack following a parameter with a
default argument, as such explicit specializations are otherwise
impossible to write. The standard wording doesn't address this case; a
issue has been filed.

This exposed a bug where we would briefly consider a parameter to have
no default argument while we parse a delay-parsed default argument for
that parameter, which is also fixed.

Partially incorporates a patch by Raul Tambre.
22 files changed:
clang/include/clang/AST/Decl.h
clang/include/clang/Sema/Template.h
clang/lib/AST/Decl.cpp
clang/lib/AST/DeclCXX.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp [changed mode: 0755->0644]
clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp
clang/test/CXX/drs/dr0xx.cpp
clang/test/CXX/drs/dr1xx.cpp
clang/test/CXX/drs/dr22xx.cpp
clang/test/CXX/drs/dr7xx.cpp
clang/test/CXX/expr/expr.post/expr.call/p4.cpp [new file with mode: 0644]
clang/test/SemaCXX/abstract.cpp
clang/test/SemaCXX/constant-expression-cxx11.cpp
clang/test/SemaCXX/decl-init-ref.cpp
clang/test/SemaCXX/implicit-exception-spec.cpp
clang/test/SemaCXX/warn-bool-conversion.cpp
clang/www/cxx_dr_status.html