[clang] [clang][OpenMP] Reject non-narrow string literals in the message clause (PR #226080)

Akash Manna via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 06:47:52 PDT 2026


================
@@ -19238,8 +18369,13 @@ OMPClause *SemaOpenMP::ActOnOpenMPMessageClause(Expr *ME,
                                                 SourceLocation EndLoc) {
   assert(ME && "NULL expr in Message clause");
   QualType Type = ME->getType();
-  if ((!Type->isPointerType() && !Type->isArrayType()) ||
-      !Type->getPointeeOrArrayElementType()->isAnyCharacterType()) {
+  // The message is consumed as a narrow string by Sema and the runtime.
+  bool IsNarrowString = false;
+  if (Type->isPointerType() || Type->isArrayType()) {
+    const auto *ElemTy = Type->getPointeeOrArrayElementType();
+    IsNarrowString = ElemTy->isCharType() || ElemTy->isChar8Type();
----------------
akash-manna-sky wrote:

Sorry I forgot GCC rejects C++20 `u8` literals too, so I dropped it. 

https://github.com/llvm/llvm-project/pull/226080


More information about the cfe-commits mailing list