[Bug c++/48396] std::type_info is implicitly declared
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 14 20:00:03 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48396
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2021-03-05 00:00:00 |2021-9-14
Keywords| |rejects-valid
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This breaks modules, and makes it very difficult to export a 'std' module, as
proposed by https://wg21.link/p2412r0
export module std;
// define it
namespace std
{
class type_info;
}
// exports
export namespace std { };
namespace std
{
export class type_info;
}
g++ -fmodules-ts -fmodule-only std.cc
std.cc:6:9: error: cannot declare 'struct std::type_info' in a different module
6 | class type_info;
| ^~~~~~~~~
<built-in>: note: declared here
std.cc:14:16: error: cannot declare 'struct std::type_info' in a different
module
14 | export class type_info;
| ^~~~~~~~~
<built-in>: note: declared here
std.cc:1:8: warning: not writing module 'std' due to errors
1 | export module std;
| ^~~~~~
As a stop-gap, could we maybe suppress the implicit definition when
-fmodules-ts is in use? Otherwise I am unable to prototype the proposal.
More information about the Gcc-bugs
mailing list