[clang] [clang] Restrict -Wnrvo to C++ code only. (PR #157059)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 8 08:32:25 PDT 2025


================
@@ -223,6 +223,7 @@ Deprecated Compiler Flags
 Modified Compiler Flags
 -----------------------
 - The `-gkey-instructions` compiler flag is now enabled by default when DWARF is emitted for plain C/C++ and optimizations are enabled. (#GH149509)
+- The `-Wnrvo` compiler flag will not apply for C language.
----------------
cor3ntin wrote:

Do we have precedent for that? Users usually don't set warning flags per language in a project that mixes both. 
We probably should just gate `warn_not_eliding_copy_on_return` on C++ (rather than the whole function), and not try to be more clever

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


More information about the cfe-commits mailing list