[clang] [clang] Warn about deprecated volatile-qualified return types (PR #137899)

via cfe-commits cfe-commits at lists.llvm.org
Sun May 4 19:33:34 PDT 2025


================
@@ -5056,13 +5056,13 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
           S.Diag(DeclType.Loc, diag::err_func_returning_qualified_void) << T;
         } else
           diagnoseRedundantReturnTypeQualifiers(S, T, D, chunkIndex);
-
-        // C++2a [dcl.fct]p12:
-        //   A volatile-qualified return type is deprecated
-        if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20)
-          S.Diag(DeclType.Loc, diag::warn_deprecated_volatile_return) << T;
       }
 
+      // C++2a [dcl.fct]p12:
+      //   A volatile-qualified return type is deprecated
+      if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20)
+        S.Diag(DeclType.Loc, diag::warn_deprecated_volatile_return) << T;
----------------
halbi2 wrote:

I understand that `CheckFunctionReturnType` is used when checking the type of a function like `using T = volatile int();` but this codepath here is used when checking a function declaration instead.

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


More information about the cfe-commits mailing list