diff mbox series

PR c++/89267 - change of error location.

Message ID 20190211175734.26338-1-jason@redhat.com
State New
Headers show
Series PR c++/89267 - change of error location. | expand

Commit Message

Jason Merrill Feb. 11, 2019, 5:57 p.m. UTC
My patch for 86943 on the branch removed this code, which led to a location
change on one of the diagnostics in constexpr-lambda8.C.  Removing this bit
wasn't the point of the patch, so let's put it back.

Applying to 8 branch.

	* pt.c (tsubst_copy_and_build): Do still clear expr location
	for instantiated thunk calls.
---
 gcc/cp/pt.c      | 8 +++++++-
 gcc/cp/ChangeLog | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)


base-commit: 161d165c044a1cc7e5d4c15358817afaf6e82f58
diff mbox series

Patch

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index aa57811d7b7..72dc1e0b569 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18539,12 +18539,18 @@  tsubst_copy_and_build (tree t,
 	    bool op = CALL_EXPR_OPERATOR_SYNTAX (t);
 	    bool ord = CALL_EXPR_ORDERED_ARGS (t);
 	    bool rev = CALL_EXPR_REVERSE_ARGS (t);
-	    if (op || ord || rev)
+	    bool thk = CALL_FROM_THUNK_P (t);
+	    if (op || ord || rev || thk)
 	      {
 		function = extract_call_expr (ret);
 		CALL_EXPR_OPERATOR_SYNTAX (function) = op;
 		CALL_EXPR_ORDERED_ARGS (function) = ord;
 		CALL_EXPR_REVERSE_ARGS (function) = rev;
+		if (thk)
+		  {
+		    /* The thunk location is not interesting.  */
+		    SET_EXPR_LOCATION (function, UNKNOWN_LOCATION);
+		  }
 	      }
 	  }
 
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 27f7032652f..7e3d056dc7b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@ 
+2019-02-11  Jason Merrill  <jason@redhat.com>
+
+	PR c++/89267 - change of error location.
+	* pt.c (tsubst_copy_and_build): Do still clear expr location
+	for instantiated thunk calls.
+
 2019-02-08  Jason Merrill  <jason@redhat.com>
 
 	PR c++/88761 - ICE with reference capture of constant.