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

Björn Svensson via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 8 07:04:03 PDT 2025


bjosv wrote:

> What I think we should do instead is the same thing that GCC does, i.e. reject the flag in the driver if we’re compiling C.

I guess rejecting the flag would make it more similar to GCC, but as I understand it, GCC don't have the `-Weverything` flag. This will make it a bit harder for us here in the clang..
The `-Weverything` flag seems to just lift any found warning-severity from ignore to a warning (or maybe I'm missing something..)

Maybe we still need to have the C++ check in `computeNRVO()`, but moving it to just avoid emitting the diagnostic error?

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


More information about the cfe-commits mailing list