================
@@ -2718,11 +2718,14 @@ void CGOpenMPRuntime::emitNumThreadsClause(
     // as if sev-level is fatal."
     Args.push_back(llvm::ConstantInt::get(
         CGM.Int32Ty, Severity == OMPC_SEVERITY_warning ? 1 : 2));
-    if (Message)
-      Args.push_back(CGF.EmitStringLiteralLValue(cast<StringLiteral>(Message))
-                         .getPointer(CGF));
-    else
+    if (Message) {
+      if (const StringLiteral *Msg = dyn_cast<StringLiteral>(Message))
+        Args.push_back(CGF.EmitStringLiteralLValue(Msg).getPointer(CGF));
+      else
----------------
ro-i wrote:

No, in that case I get a failed assertion: 
```
[...]/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:5830: llvm::Value* 
clang::CodeGen::CodeGenFunction::EmitScalarExpr(const clang::Expr*, bool): 
Assertion `E && hasScalarEvaluationKind(E->getType()) && "Invalid scalar 
expression to emit"' failed.
```

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

Reply via email to