================
@@ -1595,8 +1606,21 @@ static bool IsOverloadOrOverrideImpl(Sema &SemaRef, 
FunctionDecl *New,
 
         // Allow overloading of functions with same signature and different 
CUDA
         // target attributes.
-        if (NewTarget != OldTarget)
+        if (NewTarget != OldTarget) {
+          // Special case: non-constexpr function is allowed to override
+          // constexpr virtual function
----------------
yxsamliu wrote:

That seems to be too generic. The implicit host/device attributes are not just 
added to constexpr functions. They are also added to inherited ctors, e.g. 
https://godbolt.org/z/PvGfzj5ej . An inherited ctor may have only one implicit 
device attribute, which should be treated as a device function, like an 
explicit device attribute. I tends to think the special handling needed by 
constexpr pure-virtual function is a rare exception.

https://github.com/llvm/llvm-project/pull/121986
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to