Look through expressions to determine if a nontype template argument has been given the value of the template parameter.
Details
Diff Detail
Event Timeline
Generally LGTM with a small nit.
lib/AST/ASTContext.cpp | ||
---|---|---|
4456 | const auto * (and propagate it to other declarations)? |
lib/AST/ASTContext.cpp | ||
---|---|---|
4456 | Unfortunately, the TemplateArgument constructor in return TemplateArgument(DeclRef); takes a Expr* (and not a const Expr*). |
Discussion on the core reflector suggests that we should use odr-style equivalence when identifying the current instantiation, and not look through static const member initializers as the example in the standard suggests. Let's hold off on this until CWG has a chance to discuss it in person.
I'm sorry if this sounds dumb, but is there a way for me to follow that particular discussion?
Only if you have access to the C++ committee's internal reflectors. Sadly this is not on the issues list yet either (it only lists issues reported up to the end of June 2016, and this was filed in July). The suggestion from the end of the discussion thread was that the right rule for recognising an injected-class-name is that the template argument must be equivalent to the template parameter for the primary template / template argument for a partial specialization, using the rules in [temp.over.link] to determine equivalence. (Thus not even parentheses surrounding a non-type template argument are permitted.) There seems to be consensus that dr224 was a mistake.
const auto * (and propagate it to other declarations)?