On 6/30/25 4:25 AM, Alfie Richards wrote:
Hi Jeff,
Yes agreed, I've respun this to be standalone and moved the relevant test
from another patch to this.
Sending again for reapproval in an abbundance of caution.
Regr tested on Aarch64 and x86.
Thanks,
Alfie
-- >8 --
Add logic for the case of two FMV annotated functions with identical
signature other than the return type.
Previously this was ignored, this changes the behavior to emit a diagnostic.
gcc/cp/ChangeLog:
PR c++/119498
* decl.cc (duplicate_decls): Change logic to not always exclude FMV
annotated functions in cases of return type non-ambiguation.
gcc/testsuite/ChangeLog:
PR c++/119498
* g++.target/aarch64/pr119498.C: New test.
---
gcc/cp/decl.cc | 7 +++++--
gcc/testsuite/g++.target/aarch64/pr119498.C | 19 +++++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/g++.target/aarch64/pr119498.C
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 83c8e283b56..20ff1b9f166 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -2014,8 +2014,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool
hiding, bool was_hidden)
}
/* For function versions, params and types match, but they
are not ambiguous. */
- else if ((!DECL_FUNCTION_VERSIONED (newdecl)
- && !DECL_FUNCTION_VERSIONED (olddecl))
+ else if (((!DECL_FUNCTION_VERSIONED (newdecl)
+ && !DECL_FUNCTION_VERSIONED (olddecl))
+ || !comptypes (TREE_TYPE (TREE_TYPE (newdecl)),
+ TREE_TYPE (TREE_TYPE (olddecl)),
+ COMPARE_STRICT))
You could use same_type_p instead of comptypes (..., COMPARE_STRICT)
You probably want to use fndecl_declared_return_type like decls_match.
Jason