rsmith added a comment.

Thanks!

If you look at `Sema::InstantiateClass`, we instantiate all of the attributes 
there. The problem seems to be that that happens only when instantiating the 
class definition, which happens after the point at which we would diagnose use 
of a deprecated declaration.

This change will result in us having two copies of the `deprecated` attribute 
after we instantiate the class definition -- one from instantiating the 
declaration and another from instantiating the definition. Perhaps a better way 
to handle this would be to add a flag to the attribute definitions (in Attr.td) 
to indicate whether they apply to a declaration or just a definition (and thus 
whether they should be instantiated with a declaration, or only with a 
definition), and then instantiate the relevant subset when creating the 
`ClassTemplateSpecializationDecl` (and other kinds of decl -- I expect the same 
thing will happen for member classes of class templates, for function 
templates, and so on).

@aaron.ballman Does that seem reasonable to you? If so, we should do some 
investigation of the attribute set to figure out what the best default is.


https://reviews.llvm.org/D27486



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to