[v4,18/20] Fix FMV return type ambiguation

Message ID 20250415103155.1873461-20-alfie.richards@arm.com
State New
Headers
Series FMV refactor and ACLE compliance. |

Commit Message

Alfie Richards April 15, 2025, 10:31 a.m. UTC
  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/cp/decl.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 4a374fa29e3..6494944e3ba 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -2022,8 +2022,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))
 		   /* Let constrained hidden friends coexist for now, we'll
 		      check satisfaction later.  */
 		   && !member_like_constrained_friend_p (newdecl)