[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2021-11-30 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

Eric Gallager  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 CC||egallager at gcc dot gnu.org
 Status|ASSIGNED|RESOLVED

--- Comment #8 from Eric Gallager  ---
(In reply to Eric Gallager from comment #7)
> (In reply to Eric Gallager from comment #5)
> > (In reply to David Malcolm from comment #4)
> > > Fixed on trunk by r262199; still affects gcc-8 and gcc-7 branches.
> > 
> > so what should be the target milestone then?
> 
> (In reply to David Malcolm from comment #6)
> > Author: dmalcolm
> > Date: Thu Feb 14 23:02:45 2019
> > New Revision: 268909
> > 
> > URL: https://gcc.gnu.org/viewcvs?rev=268909=gcc=rev
> > Log:
> > C++: don't offer bogus "._0" suggestions (PR c++/86329)
> > 
> > PR c++/86329 reports that the C++ frontend can offer bogus suggestions like:
> > 
> >   #include 
> > 
> >   int compare()
> >   {
> > return __n1 - __n2;
> >   }
> > 
> > suggested.cc: In function 'int compare()':
> > suggested.cc:5:10: error: '__n1' was not declared in this scope
> >return __n1 - __n2;
> >   ^~~~
> > suggested.cc:5:10: note: suggested alternative: '._61'
> >return __n1 - __n2;
> >   ^~~~
> >   ._61
> > suggested.cc:5:17: error: '__n2' was not declared in this scope
> >return __n1 - __n2;
> >  ^~~~
> > suggested.cc:5:17: note: suggested alternative: '._72'
> >return __n1 - __n2;
> >  ^~~~
> >  ._72
> > 
> > The dot-prefixed names are an implementation detail of how we implement
> > anonymous enums found in the header files, generated via
> > anon_aggrname_format in make_anon_name.
> > 
> > This patch uses anon_aggrname_p to filter them out when considering
> > which names to suggest.
> > 
> > gcc/cp/ChangeLog:
> > Backport of r262199 from trunk.
> > 2018-06-27  David Malcolm  
> > 
> > PR c++/86329
> > * name-lookup.c (consider_binding_level): Filter out names that
> > match anon_aggrname_p.
> > 
> > gcc/testsuite/ChangeLog:
> > Backport of r262199 from trunk.
> > 2018-06-27  David Malcolm  
> > 
> > PR c++/86329
> > * g++.dg/lookup/pr86329.C: New test.
> > 
> > 
> > Added:
> > branches/gcc-8-branch/gcc/testsuite/g++.dg/lookup/pr86329.C
> > Modified:
> > branches/gcc-8-branch/gcc/cp/ChangeLog
> > branches/gcc-8-branch/gcc/cp/name-lookup.c
> > branches/gcc-8-branch/gcc/testsuite/ChangeLog
> 
> So, since this fixed it for 8, just 7 is left, so changing the target
> milestone to 7.4

I'm pretty sure 7 is closed now, so I'm going to close this as fixed for open
branches.

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2019-11-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.4 |---

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2019-05-13 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

Eric Gallager  changed:

   What|Removed |Added

   Target Milestone|--- |7.4

--- Comment #7 from Eric Gallager  ---
(In reply to Eric Gallager from comment #5)
> (In reply to David Malcolm from comment #4)
> > Fixed on trunk by r262199; still affects gcc-8 and gcc-7 branches.
> 
> so what should be the target milestone then?

(In reply to David Malcolm from comment #6)
> Author: dmalcolm
> Date: Thu Feb 14 23:02:45 2019
> New Revision: 268909
> 
> URL: https://gcc.gnu.org/viewcvs?rev=268909=gcc=rev
> Log:
> C++: don't offer bogus "._0" suggestions (PR c++/86329)
> 
> PR c++/86329 reports that the C++ frontend can offer bogus suggestions like:
> 
>   #include 
> 
>   int compare()
>   {
> return __n1 - __n2;
>   }
> 
> suggested.cc: In function 'int compare()':
> suggested.cc:5:10: error: '__n1' was not declared in this scope
>return __n1 - __n2;
>   ^~~~
> suggested.cc:5:10: note: suggested alternative: '._61'
>return __n1 - __n2;
>   ^~~~
>   ._61
> suggested.cc:5:17: error: '__n2' was not declared in this scope
>return __n1 - __n2;
>  ^~~~
> suggested.cc:5:17: note: suggested alternative: '._72'
>return __n1 - __n2;
>  ^~~~
>  ._72
> 
> The dot-prefixed names are an implementation detail of how we implement
> anonymous enums found in the header files, generated via
> anon_aggrname_format in make_anon_name.
> 
> This patch uses anon_aggrname_p to filter them out when considering
> which names to suggest.
> 
> gcc/cp/ChangeLog:
>   Backport of r262199 from trunk.
>   2018-06-27  David Malcolm  
> 
>   PR c++/86329
>   * name-lookup.c (consider_binding_level): Filter out names that
>   match anon_aggrname_p.
> 
> gcc/testsuite/ChangeLog:
>   Backport of r262199 from trunk.
>   2018-06-27  David Malcolm  
> 
>   PR c++/86329
>   * g++.dg/lookup/pr86329.C: New test.
> 
> 
> Added:
> branches/gcc-8-branch/gcc/testsuite/g++.dg/lookup/pr86329.C
> Modified:
> branches/gcc-8-branch/gcc/cp/ChangeLog
> branches/gcc-8-branch/gcc/cp/name-lookup.c
> branches/gcc-8-branch/gcc/testsuite/ChangeLog

So, since this fixed it for 8, just 7 is left, so changing the target milestone
to 7.4

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2019-02-14 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

--- Comment #6 from David Malcolm  ---
Author: dmalcolm
Date: Thu Feb 14 23:02:45 2019
New Revision: 268909

URL: https://gcc.gnu.org/viewcvs?rev=268909=gcc=rev
Log:
C++: don't offer bogus "._0" suggestions (PR c++/86329)

PR c++/86329 reports that the C++ frontend can offer bogus suggestions like:

  #include 

  int compare()
  {
return __n1 - __n2;
  }

suggested.cc: In function 'int compare()':
suggested.cc:5:10: error: '__n1' was not declared in this scope
   return __n1 - __n2;
  ^~~~
suggested.cc:5:10: note: suggested alternative: '._61'
   return __n1 - __n2;
  ^~~~
  ._61
suggested.cc:5:17: error: '__n2' was not declared in this scope
   return __n1 - __n2;
 ^~~~
suggested.cc:5:17: note: suggested alternative: '._72'
   return __n1 - __n2;
 ^~~~
 ._72

The dot-prefixed names are an implementation detail of how we implement
anonymous enums found in the header files, generated via
anon_aggrname_format in make_anon_name.

This patch uses anon_aggrname_p to filter them out when considering
which names to suggest.

gcc/cp/ChangeLog:
Backport of r262199 from trunk.
2018-06-27  David Malcolm  

PR c++/86329
* name-lookup.c (consider_binding_level): Filter out names that
match anon_aggrname_p.

gcc/testsuite/ChangeLog:
Backport of r262199 from trunk.
2018-06-27  David Malcolm  

PR c++/86329
* g++.dg/lookup/pr86329.C: New test.


Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/lookup/pr86329.C
Modified:
branches/gcc-8-branch/gcc/cp/ChangeLog
branches/gcc-8-branch/gcc/cp/name-lookup.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2018-09-23 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

--- Comment #5 from Eric Gallager  ---
(In reply to David Malcolm from comment #4)
> Fixed on trunk by r262199; still affects gcc-8 and gcc-7 branches.

so what should be the target milestone then?

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2018-06-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

--- Comment #4 from David Malcolm  ---
Fixed on trunk by r262199; still affects gcc-8 and gcc-7 branches.

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2018-06-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

--- Comment #3 from David Malcolm  ---
Author: dmalcolm
Date: Wed Jun 27 23:21:46 2018
New Revision: 262199

URL: https://gcc.gnu.org/viewcvs?rev=262199=gcc=rev
Log:
C++: don't offer bogus "._0" suggestions (PR c++/86329)

PR c++/86329 reports that the C++ frontend can offer bogus suggestions like:

#include 

int compare()
{
  return __n1 - __n2;
}

suggested.cc: In function 'int compare()':
suggested.cc:5:10: error: '__n1' was not declared in this scope
   return __n1 - __n2;
  ^~~~
suggested.cc:5:10: note: suggested alternative: '._61'
   return __n1 - __n2;
  ^~~~
  ._61
suggested.cc:5:17: error: '__n2' was not declared in this scope
   return __n1 - __n2;
 ^~~~
suggested.cc:5:17: note: suggested alternative: '._72'
   return __n1 - __n2;
 ^~~~
 ._72

The dot-prefixed names are an implementation detail of how we implement
anonymous enums found in the header files, generated via
anon_aggrname_format in make_anon_name.

This patch uses anon_aggrname_p to filter them out when considering
which names to suggest.

gcc/cp/ChangeLog:
PR c++/86329
* name-lookup.c (consider_binding_level): Filter out names that
match anon_aggrname_p.

gcc/testsuite/ChangeLog:
PR c++/86329
* g++.dg/lookup/pr86329.C: New test.


Added:
trunk/gcc/testsuite/g++.dg/lookup/pr86329.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/name-lookup.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2018-06-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

--- Comment #2 from David Malcolm  ---
Candidate patch: https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01694.html

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2018-06-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

--- Comment #1 from David Malcolm  ---
Confirmed on trunk, gcc-8, and gcc-7.
Doesn't affect gcc-6.

The bogus dotted names are coming from anonymous enums in the header; a more
minimal reproducer is:

enum {};

int test()
{
  return __0;
}

pr86329.C: In function ‘int test()’:
pr86329.C:5:10: error: ‘__0’ was not declared in this scope
   return __0;
  ^~~
pr86329.C:5:10: note: suggested alternative: ‘._0’
   return __0;
  ^~~
  ._0

I'm working on a fix.

[Bug c++/86329] Bogus fix-it hint: note: suggested alternative: '._72'

2018-06-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86329

David Malcolm  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-06-27
   Assignee|unassigned at gcc dot gnu.org  |dmalcolm at gcc dot 
gnu.org
 Ever confirmed|0   |1