[Bug c++/88245] Wrong location for "explicitly defaulted here"

2023-04-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88245

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=67574

--- Comment #4 from Andrew Pinski  ---
I think this is a dup of bug 67574 ...

[Bug c++/88245] Wrong location for "explicitly defaulted here"

2019-06-17 Thread mbelivea at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88245

--- Comment #3 from Matthew Beliveau  ---
The location for the note message is getting reset in cp/method.c
(synthesize_method), line 894, here:

  if (!DECL_INHERITED_CTOR (fndecl))
DECL_SOURCE_LOCATION (fndecl)
  = DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT (fndecl)));

I found that the fndecl had the right location for the note going into the
function but then it was reset to something that it never was before. So since
we are testing with explicitly defaulted functions, maybe we shouldn't reset
the location? 

A possible fix would be this:

  if (!DECL_INHERITED_CTOR (fndecl) && !DECL_DEFAULTED_FN(fndecl))
DECL_SOURCE_LOCATION (fndecl)
  = DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT (fndecl)));

This would make sure the location for explicitly defaulted functions wouldn't
be reset here, and make the test case work has intended. However, I'm not
entirely sure if this is the appropriate fix

[Bug c++/88245] Wrong location for "explicitly defaulted here"

2019-06-11 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88245

--- Comment #2 from Marek Polacek  ---
The inform call already uses DECL_SOURCE_LOCATION but that's bogus:

 9288   else if (DECL_DEFAULTED_FN (old_decl))
 9289 {
 9290   error ("definition of explicitly-defaulted %q+D", decl);
 9291   inform (DECL_SOURCE_LOCATION (old_decl),
 9292   "%q#D explicitly defaulted here", old_decl);
 9293   return NULL_TREE;

so that's what we'll have to improve.

[Bug c++/88245] Wrong location for "explicitly defaulted here"

2019-06-11 Thread mbelivea at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88245

Matthew Beliveau  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

[Bug c++/88245] Wrong location for "explicitly defaulted here"

2019-06-10 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88245

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-06-10
 CC||mbelivea at redhat dot com,
   ||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.