https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110028

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-05-30
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Steven Xia from comment #0)
> The following program is very slow to compile (>10 seconds) and return
> error. Compared to clang (<1 second).

N.B. -std=c++20 or similar is needed to reproduce this. It's fast with the
default options.

It's fast with -fmax-errors=2000 so I think the error handling machinery gets
stuck in a loop, or the time is spent generating the actual error output.

Maybe we should instantly fail if any libstdc++ header is included inside a
namespace, since that's explicitly disallowed by the standard:

"A translation unit shall include a header only outside of any declaration or
definition and, in the case of a module unit, only in its
global-module-fragment, and shall include the header or import the
corresponding header unit lexically before the first reference in that
translation unit to any of the entities declared in that header. No diagnostic
is required."

That would need some new attribute or pragma though.

Reply via email to