[PATCH] D38320: [clang] Fix serializers for `TypeTemplateParmDecl` + related types
Steve O'Brien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 31 19:43:33 PDT 2018
elsteveogrande added inline comments.
================
Comment at: lib/Serialization/ASTReaderDecl.cpp:3448-3456
if (!inheritDefaultTemplateArgument(Context, FTTP, ToParam))
break;
} else if (auto *FNTTP = dyn_cast<NonTypeTemplateParmDecl>(FromParam)) {
if (!inheritDefaultTemplateArgument(Context, FNTTP, ToParam))
break;
} else {
if (!inheritDefaultTemplateArgument(
----------------
rsmith wrote:
> The idea is to reconstruct the 'inherited default template argument' information when we read a template declaration and find it's a redeclaration of another one, rather than serializing it and deserializing it. (In particular, if an imported template redeclares a non-imported template or a template imported from an unrelated module, it won't know that the prior declaration had a default argument because it doesn't know what the prior declaration was.)
>
> The problem with our implementation of that idea is these `break`s: we're (incorrectly) assuming that a template parameter cannot have a default argument if there's a later template parameter that does not have one.
>
> I removed the `break`s in r338438, and it fixed your testcase (which I committed alongside that change). Can you check to see if that also fixes the original problem from which this was reduced? Thanks!
Thanks @rsmith! It sounds like that ought to do it. We'll try again on our end and let you know. Thanks for the quick fix!
Repository:
rC Clang
https://reviews.llvm.org/D38320
More information about the cfe-commits
mailing list