================
@@ -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
----------------
Artem-B wrote:

I see. So, we have a distinction between implicit attribute derived from the 
explicit one, and the implicit attributes conjured by compiler for the 
compiler-generated code like special functions and lambdas. AFAICT we have no 
good way to do so. E.g. telling apart inherited constructor with explicit HD 
attributes and a default constructor with implicit HD attributes would require 
more digging.

OK. Let's keep it narrow for now. We can consider relaxation if/when we have 
actual use cases for it.

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