================
@@ -1496,6 +1496,12 @@ class DeclRefExpr final
     setDependence(computeDependence(this, Context));
   }
 
+  /// This DeclRefExpr is parenthesized as if it were written in parentheses,
+  /// e.g., "(x)". This is used in replacement expressions produced from
+  /// canonical template arguments.
+  bool isParenthesized() const { return DeclRefExprBits.IsParenthesized; }
----------------
mizvekov wrote:

Well, this is probably not the best place to see what's happening, you can 
scroll down to where 'setParenthesized' is used.

But basically we have a `TemplateArgument` of declaration kind, converted to a 
parameter of reference type.
When converting this argument back to expression, this is normally converted to 
a DeclRef, with possible implicit casts. In order to preserve this reference 
type in a decltype expression, we could wrap the expression in parenthesis, but 
under old standards, we are not allowed to look through parenthesis around 
declarations used as template arguments.

We would have to use an AST node which is looked through under these old 
standards, but is not considered an implicit cast.

So I am thinking either this solution here, a new bit for ParenExpr, or 
possibly a new AST node, something like an ImplicitParenExpr.

https://github.com/llvm/llvm-project/pull/200850
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to