[gcc(refs/users/aoliva/heads/testme)] c++: arm -Wdeprecated fails for ctors
Alexandre Oliva
aoliva@gcc.gnu.org
Mon Mar 23 01:43:03 GMT 2026
https://gcc.gnu.org/g:bc5fb436045e4425f46e16c9433b5c44370dddec
commit bc5fb436045e4425f46e16c9433b5c44370dddec
Author: Alexandre Oliva <oliva@adacore.com>
Date: Sun Mar 22 22:32:08 2026 -0300
c++: arm -Wdeprecated fails for ctors
ARM requires C++ constructors to return the 'this' pointer. Setting
that up disables warnings at the ctor location for Wuse_after_free.
Unfortunately, the nowarn_spec_t mapping maps both Wuse_after_free and
Wdeprecated_declaration to the same NW_OTHER catchall group, so we
don't get deprecation warnings for constructors, and libstdc++'s
20_util/pair/cons/99957.cc fails.
We may want to consider also explicitly mapping Wdeprecated and
Wdeprecated_declaration to another group, but this minimal change
appears to be enough.
for gcc/ChangeLog
* gcc-diagnostic-spec.cc (nowarn_spec_t::nowarn_spec_t): Map
OPT_Wuse_after_free like OPT_Wuse_after_free_.
Diff:
---
gcc/gcc-diagnostic-spec.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/gcc/gcc-diagnostic-spec.cc b/gcc/gcc-diagnostic-spec.cc
index dd631699539d..813625e28773 100644
--- a/gcc/gcc-diagnostic-spec.cc
+++ b/gcc/gcc-diagnostic-spec.cc
@@ -100,6 +100,7 @@ nowarn_spec_t::nowarn_spec_t (opt_code opt)
case OPT_Wdangling_pointer_:
case OPT_Wreturn_local_addr:
+ case OPT_Wuse_after_free:
case OPT_Wuse_after_free_:
m_bits = NW_DANGLING;
break;
More information about the Gcc-cvs
mailing list