Commit e0365bd3 by Jason Merrill Committed by Jason Merrill

Preserve the location of explicitly defaulted functions.

	* decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
	explicitly defaulted functions.
	* method.c (synthesize_method): Likewise.

From-SVN: r276902
parent c6b6fde0
2019-10-11 Jason Merrill <jason@redhat.com>
* decl2.c (mark_used): Don't clobber DECL_SOURCE_LOCATION on
explicitly defaulted functions.
* method.c (synthesize_method): Likewise.
2019-10-11 Jakub Jelinek <jakub@redhat.com> 2019-10-11 Jakub Jelinek <jakub@redhat.com>
PR c++/91987 PR c++/91987
......
...@@ -5588,7 +5588,8 @@ mark_used (tree decl, tsubst_flags_t complain) ...@@ -5588,7 +5588,8 @@ mark_used (tree decl, tsubst_flags_t complain)
/* Remember the current location for a function we will end up /* Remember the current location for a function we will end up
synthesizing. Then we can inform the user where it was synthesizing. Then we can inform the user where it was
required in the case of error. */ required in the case of error. */
DECL_SOURCE_LOCATION (decl) = input_location; if (DECL_ARTIFICIAL (decl))
DECL_SOURCE_LOCATION (decl) = input_location;
/* Synthesizing an implicitly defined member function will result in /* Synthesizing an implicitly defined member function will result in
garbage collection. We must treat this situation as if we were garbage collection. We must treat this situation as if we were
......
...@@ -892,7 +892,7 @@ synthesize_method (tree fndecl) ...@@ -892,7 +892,7 @@ synthesize_method (tree fndecl)
/* Reset the source location, we might have been previously /* Reset the source location, we might have been previously
deferred, and thus have saved where we were first needed. */ deferred, and thus have saved where we were first needed. */
if (!DECL_INHERITED_CTOR (fndecl)) if (DECL_ARTIFICIAL (fndecl) && !DECL_INHERITED_CTOR (fndecl))
DECL_SOURCE_LOCATION (fndecl) DECL_SOURCE_LOCATION (fndecl)
= DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT (fndecl))); = DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT (fndecl)));
...@@ -953,8 +953,9 @@ synthesize_method (tree fndecl) ...@@ -953,8 +953,9 @@ synthesize_method (tree fndecl)
pop_deferring_access_checks (); pop_deferring_access_checks ();
if (error_count != errorcount || warning_count != warningcount + werrorcount) if (error_count != errorcount || warning_count != warningcount + werrorcount)
inform (input_location, "synthesized method %qD first required here", if (DECL_ARTIFICIAL (fndecl))
fndecl); inform (input_location, "synthesized method %qD first required here",
fndecl);
} }
/* Build a reference to type TYPE with cv-quals QUALS, which is an /* Build a reference to type TYPE with cv-quals QUALS, which is an
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment