================
@@ -8409,7 +8409,12 @@ NamedDecl *Sema::ActOnVariableDeclarator(
if (IsMemberSpecialization) {
if (NewTemplate && NewVD->getPreviousDecl()) {
- NewTemplate->setMemberSpecialization();
+ // In valid code, this should always hold, but in the case where a
+ // previous declaration was invalid/didn't have an instantiated-from
+ // field, this will not have been set, so skip setting
+ // MemberSpecialization if we don't have an instantiated-from.
+ if (NewTemplate->getInstantiatedFromMemberTemplate())
----------------
erichkeane wrote:
> Yeah, I see.
>
> So the first error recovery is bad by accepting the member specialization
> with no previous declaration.
>
> We could fix that by: (more complex idea first)
>
> 1. Create a fake instantiated declaration
>
> 2. Not add the member specialization as a member, so we don't see a
> previous declaration in future attempts to member specialize.
1 there is an interesting idea... I am going to mess around with that briefly,
else the 2nd one is pretty reasonable as well. I'll mess with them and see if
I can come up with something reasonable.
(I DID read your other message, but only after I submitted that one, looks like
they crossed in the internet :)
https://github.com/llvm/llvm-project/pull/209604
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits