[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-04-13 Thread ebotcazou at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

--- Comment #13 from Eric Botcazou  ---
Yes, thanks for the quick turnaround.

[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-04-11 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

Marek Polacek  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|REOPENED|RESOLVED

--- Comment #12 from Marek Polacek  ---
Should be fixed, sorry again for the breakage.

[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-04-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

--- Comment #11 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Marek Polacek
:

https://gcc.gnu.org/g:1004d3bb5e590a2cc3d22bc9fb11d3bf4978a982

commit r10-9695-g1004d3bb5e590a2cc3d22bc9fb11d3bf4978a982
Author: Marek Polacek 
Date:   Sun Apr 11 16:58:09 2021 -0400

c++: Use FOR_EACH_VEC_ELT instead of range-based for loop.

gcc/cp/ChangeLog:

PR c++/97966
* pt.c (instantiate_class_template_1): Use FOR_EACH_VEC_ELT instead
of range-based for loop.

[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-04-11 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

--- Comment #10 from Marek Polacek  ---
Argh!  Sorry about that, will fix.

[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-04-11 Thread ebotcazou at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

Eric Botcazou  changed:

   What|Removed |Added

 Resolution|FIXED   |---
 Status|RESOLVED|REOPENED
 CC||ebotcazou at gcc dot gnu.org

--- Comment #9 from Eric Botcazou  ---
This breaks the build with older compilers:

../../src/gcc/cp/pt.c: In function 'tree_node*
instantiate_class_template_1(tree)':
../../src/gcc/cp/pt.c:12137:17: error: range-based 'for' loops are not allowed
in C++98 mode

[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-04-09 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

Marek Polacek  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #8 from Marek Polacek  ---
Fixed in GCC 10.4 too.

[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-04-09 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

--- Comment #7 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Marek Polacek
:

https://gcc.gnu.org/g:6f45079013256ed730c92bf35af4e6394cb5a2c0

commit r10-9683-g6f45079013256ed730c92bf35af4e6394cb5a2c0
Author: Marek Polacek 
Date:   Fri Apr 9 18:31:12 2021 -0400

c++: ICE with delayed noexcept and attribute used [PR97966]

Another ICE with delayed noexcept parsing, but a bit gnarlier.

A function definition marked with __attribute__((used)) ought to be
emitted even when it is not referenced in the TU.  For a member function
template marked with __attribute__((used)) this means that it will
be instantiated: in instantiate_class_template_1 we have

11971   /* Instantiate members marked with attribute used.  */
11972   if (r != error_mark_node && DECL_PRESERVE_P (r))
11973 mark_used (r);

It is not so surprising that this doesn't work well with delayed
noexcept parsing: when we're processing the function template we delay
the parsing, so the member "foo" is found, but then when we're
instantiating it, "foo" hasn't yet been seen, which creates a
discrepancy and a crash ensues.  "foo" hasn't yet been seen because
instantiate_class_template_1 just loops over the class members and
instantiates right away.

To make it work, this patch uses a vector to keep track of members
marked with attribute used and uses it to instantiate such members
only after we're done with the class; in particular, after we have
called finish_member_declaration for each member.  And we ought to
be verifying that we did emit such members, so I've added a bunch
of dg-finals.

gcc/cp/ChangeLog:

PR c++/97966
* pt.c (instantiate_class_template_1): Instantiate members
marked with attribute used only after we're done instantiating
the class.

gcc/testsuite/ChangeLog:

PR c++/97966
* g++.dg/cpp0x/noexcept63.C: New test.

[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-04-08 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|10.3|10.4

--- Comment #6 from Richard Biener  ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.

[Bug c++/97966] [10 Regression] maybe_instantiate_noexcept

2021-01-21 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97966

Marek Polacek  changed:

   What|Removed |Added

Summary|[10/11 Regression]  |[10 Regression]
   |maybe_instantiate_noexcept  |maybe_instantiate_noexcept

--- Comment #5 from Marek Polacek  ---
Fixed on trunk so far.