================
@@ -7272,14 +7359,9 @@ ExprResult Sema::CheckTemplateArgument(NamedDecl *Param, 
QualType ParamType,
     return Arg;
   }
 
-  // Avoid making a copy when initializing a template parameter of class type
-  // from a template parameter object of the same type. This is going beyond
-  // the standard, but is required for soundness: in
-  //   template<A a> struct X { X *p; X<a> *q; };
-  // ... we need p and q to have the same type.
-  //
-  // Similarly, don't inject a call to a copy constructor when initializing
-  // from a template parameter of the same type.
+  // Fast path. A valid template parameter object is equivalent to its copy. No
+  // need to make a copy to check again when initializing a template parameter
+  // of class type from a template parameter object of the same type.
----------------
cor3ntin wrote:

Does that holds when the type has a non-trivial copy constructor? It would not 
necessarily, right?

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

Reply via email to