[modules] Support merging a parsed default argument with an imported hidden one for non-type and template template parameters too.

llvm-svn: 237815
This commit is contained in:
Richard Smith 2015-05-20 18:24:21 +00:00
parent c7d48d1a16
commit fd8b64eea0
2 changed files with 6 additions and 1 deletions

View File

@ -1358,6 +1358,8 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
// Merge default arguments for non-type template parameters // Merge default arguments for non-type template parameters
NonTypeTemplateParmDecl *OldNonTypeParm NonTypeTemplateParmDecl *OldNonTypeParm
= OldParams? cast<NonTypeTemplateParmDecl>(*OldParam) : nullptr; = OldParams? cast<NonTypeTemplateParmDecl>(*OldParam) : nullptr;
if (OldNonTypeParm && !LookupResult::isVisible(*this, OldNonTypeParm))
OldNonTypeParm = nullptr;
if (NewNonTypeParm->isParameterPack()) { if (NewNonTypeParm->isParameterPack()) {
assert(!NewNonTypeParm->hasDefaultArgument() && assert(!NewNonTypeParm->hasDefaultArgument() &&
"Parameter packs can't have a default argument!"); "Parameter packs can't have a default argument!");
@ -1405,6 +1407,8 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
// Merge default arguments for template template parameters // Merge default arguments for template template parameters
TemplateTemplateParmDecl *OldTemplateParm TemplateTemplateParmDecl *OldTemplateParm
= OldParams? cast<TemplateTemplateParmDecl>(*OldParam) : nullptr; = OldParams? cast<TemplateTemplateParmDecl>(*OldParam) : nullptr;
if (OldTemplateParm && !LookupResult::isVisible(*this, OldTemplateParm))
OldTemplateParm = nullptr;
if (NewTemplateParm->isParameterPack()) { if (NewTemplateParm->isParameterPack()) {
assert(!NewTemplateParm->hasDefaultArgument() && assert(!NewTemplateParm->hasDefaultArgument() &&
"Parameter packs can't have a default argument!"); "Parameter packs can't have a default argument!");

View File

@ -44,4 +44,5 @@ namespace G {
typedef enum {} l; typedef enum {} l;
} }
template<typename T = int> int H(int a = 1); template<typename T = int, int N = 3, template<typename> class K = F> int H(int a = 1);
template<typename T = int, int N = 3, template<typename> class K = F> using I = decltype(H<T, N, K>());