aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-10-11 14:55:14 -0400
committerJason Merrill <jason@gcc.gnu.org>2019-10-11 14:55:14 -0400
commite0365bd388bac7641e1767222b9ddc683dbf057a (patch)
treecfff30e5aef5d3a9de926065733b52bd7c1abfcf /gcc/cp/method.c
parentc6b6fde0bccc82d1a66e36b3a31177b5188cd52e (diff)
downloadgcc-e0365bd388bac7641e1767222b9ddc683dbf057a.zip
gcc-e0365bd388bac7641e1767222b9ddc683dbf057a.tar.gz
gcc-e0365bd388bac7641e1767222b9ddc683dbf057a.tar.bz2
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
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 01bf534..73a0114 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -892,7 +892,7 @@ synthesize_method (tree fndecl)
/* Reset the source location, we might have been previously
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 (TYPE_NAME (DECL_CONTEXT (fndecl)));
@@ -953,8 +953,9 @@ synthesize_method (tree fndecl)
pop_deferring_access_checks ();
if (error_count != errorcount || warning_count != warningcount + werrorcount)
- inform (input_location, "synthesized method %qD first required here",
- fndecl);
+ if (DECL_ARTIFICIAL (fndecl))
+ inform (input_location, "synthesized method %qD first required here",
+ fndecl);
}
/* Build a reference to type TYPE with cv-quals QUALS, which is an