* [Bug c++/114600] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
@ 2024-04-05 10:07 ` m.cencora at gmail dot com
2024-04-05 12:55 ` [Bug c++/114600] [14 Regression] " ppalka at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: m.cencora at gmail dot com @ 2024-04-05 10:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
--- Comment #1 from m.cencora at gmail dot com ---
gcc version info:
g++-14 (Ubuntu 14-20240330-1ubuntu2) 14.0.1 20240330 (experimental) [master
r14-9728-g6fc84f680d0]
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
2024-04-05 10:07 ` [Bug c++/114600] " m.cencora at gmail dot com
@ 2024-04-05 12:55 ` ppalka at gcc dot gnu.org
2024-04-05 12:58 ` ppalka at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-05 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nshead at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
Keywords| |rejects-valid
Target Milestone|--- |14.0
Blocks| |103524
Summary|[modules] redefinition |[14 Regression] [modules]
|errors when using certain |redefinition errors when
|std headers in GMF |using certain std headers
| |in GMF
Ever confirmed|0 |1
Last reconfirmed| |2024-04-05
Status|UNCONFIRMED |NEW
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, started with r14-6978.
Mechanical reduction:
$ cat 114600.h
namespace std {
template <typename> struct integral_constant {
typedef integral_constant type;
};
template <bool> using __enable_if_t = int;
template <typename> auto __and_fn() -> integral_constant<bool>;
template <typename... _Bn> struct __and_ : decltype(__and_fn<_Bn...>) {};
template <typename... _Cond>
using _Require = __enable_if_t<__and_<_Cond...>::value>;
template <typename _Tp> _Require<_Tp> swap();
namespace __swappable_details {
using std::swap;
}
} // namespace std
$ cat 114600_a.C
module;
#include "114600.h"
export module std;
$ cat 114600_b.C
import std;
#include "114600.h"
int main()
{
}
$ g++ -fmodules-ts 114600_*.C
114600.h:3:29: error: template definition of non-template 'typedef struct
std::integral_constant< <template-parameter-1-1> > std::integral_constant<
<template-parameter-1-1> >::type'
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
[Bug 103524] [meta-bug] modules issue
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
2024-04-05 10:07 ` [Bug c++/114600] " m.cencora at gmail dot com
2024-04-05 12:55 ` [Bug c++/114600] [14 Regression] " ppalka at gcc dot gnu.org
@ 2024-04-05 12:58 ` ppalka at gcc dot gnu.org
2024-04-05 13:10 ` nshead at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-05 12:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=109679
Keywords| |ice-on-valid-code
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Shorter reduction demonstrating an ICE:
$ cat 114600.h # other files same as before
namespace std {
template<class T> struct A { int n; };
template<class T> A<T> f();
namespace __swappable_details { using std::f; }
}
internal compiler error: in finish_member_declaration, at cp/semantics.cc:3771
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (2 preceding siblings ...)
2024-04-05 12:58 ` ppalka at gcc dot gnu.org
@ 2024-04-05 13:10 ` nshead at gcc dot gnu.org
2024-04-05 13:33 ` ppalka at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-04-05 13:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=99000
--- Comment #4 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
In general we don't yet implement merging of textual redefinitions; I guess
this ultimately falls under that, but I'm not sure we have a dedicated bug
report for that yet? Maybe PR99000.
I'm not yet sure exactly why my patch caused this to start failing though; it
sounds like it's exporting some using-decls even though they aren't directly
exported, which I suppose is still a bug in its own right.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (3 preceding siblings ...)
2024-04-05 13:10 ` nshead at gcc dot gnu.org
@ 2024-04-05 13:33 ` ppalka at gcc dot gnu.org
2024-04-10 13:24 ` nshead at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-05 13:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Nathaniel Shead from comment #4)
> In general we don't yet implement merging of textual redefinitions; I guess
> this ultimately falls under that, but I'm not sure we have a dedicated bug
> report for that yet? Maybe PR99000.
Makes sense.
> I'm not yet sure exactly why my patch caused this to start failing though;
> it sounds like it's exporting some using-decls even though they aren't
> directly exported, which I suppose is still a bug in its own right.
Hmm, should the check added to add_binding_entity
flags & (WMB_Using | WMB_Export)
instead be
(flags & WMB_Using) && (flags & WMB_Export)
?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (4 preceding siblings ...)
2024-04-05 13:33 ` ppalka at gcc dot gnu.org
@ 2024-04-10 13:24 ` nshead at gcc dot gnu.org
2024-04-10 14:27 ` m.cencora at gmail dot com
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-04-10 13:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
--- Comment #6 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #5)
> (In reply to Nathaniel Shead from comment #4)
> > I'm not yet sure exactly why my patch caused this to start failing though;
> > it sounds like it's exporting some using-decls even though they aren't
> > directly exported, which I suppose is still a bug in its own right.
> Hmm, should the check added to add_binding_entity
> flags & (WMB_Using | WMB_Export)
> instead be
> (flags & WMB_Using) && (flags & WMB_Export)
> ?
Right, of course, thanks. This fixes this issue, but while constructing some
test cases I've found a number of other issues with exported using-decls. I'll
submit a patch series hopefully soonish to fix the issues I can.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (5 preceding siblings ...)
2024-04-10 13:24 ` nshead at gcc dot gnu.org
@ 2024-04-10 14:27 ` m.cencora at gmail dot com
2024-04-10 15:41 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: m.cencora at gmail dot com @ 2024-04-10 14:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
--- Comment #7 from m.cencora at gmail dot com ---
Created attachment 57921
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57921&action=edit
Full "std" module
FYI if you want to stress test the modules impl w.r.t. similar issues, here is
std.cpp for almost whole Standard Library.
Some code is disabled (with 'bug' comment).
This is based on semi-preprocessed and hand-adjusted 'std' module code from
libc++
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (6 preceding siblings ...)
2024-04-10 14:27 ` m.cencora at gmail dot com
@ 2024-04-10 15:41 ` redi at gcc dot gnu.org
2024-04-10 20:55 ` m.cencora at gmail dot com
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2024-04-10 15:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks. I hope we'll end up auto-generating a file like that from
../gcc/cp/cxxapi-data.csv
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (7 preceding siblings ...)
2024-04-10 15:41 ` redi at gcc dot gnu.org
@ 2024-04-10 20:55 ` m.cencora at gmail dot com
2024-04-10 21:03 ` m.cencora at gmail dot com
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: m.cencora at gmail dot com @ 2024-04-10 20:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
--- Comment #9 from m.cencora at gmail dot com ---
(In reply to Jonathan Wakely from comment #8)
> Thanks. I hope we'll end up auto-generating a file like that from
> ../gcc/cp/cxxapi-data.csv
Hmm, then that file will have to be extended because we need information about
inline namespaces, e.g. std::literals::chrono_literals.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (8 preceding siblings ...)
2024-04-10 20:55 ` m.cencora at gmail dot com
@ 2024-04-10 21:03 ` m.cencora at gmail dot com
2024-04-15 8:26 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: m.cencora at gmail dot com @ 2024-04-10 21:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
m.cencora at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #57921|0 |1
is obsolete| |
--- Comment #10 from m.cencora at gmail dot com ---
Created attachment 57924
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57924&action=edit
Full "std' modules with workarounds
Here is an improved version of "std" module, with workarounds for:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114683
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114685
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (9 preceding siblings ...)
2024-04-10 21:03 ` m.cencora at gmail dot com
@ 2024-04-15 8:26 ` cvs-commit at gcc dot gnu.org
2024-04-24 13:46 ` ppalka at gcc dot gnu.org
2024-04-24 13:50 ` ppalka at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-15 8:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:
https://gcc.gnu.org/g:3878e9aeb30cb192f769997c52743daf8190744c
commit r14-9961-g3878e9aeb30cb192f769997c52743daf8190744c
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date: Mon Apr 8 23:34:42 2024 +1000
c++: Only emit exported GMF usings [PR114600]
A typo in r14-6978 made us emit too many things. This ensures that we
don't emit using-declarations from the GMF that we don't need to.
PR c++/114600
gcc/cp/ChangeLog:
* module.cc (depset::hash::add_binding_entity): Require both
WMB_Using and WMB_Export for GMF entities.
gcc/testsuite/ChangeLog:
* g++.dg/modules/using-14.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Co-authored-by: Patrick Palka <ppalka@redhat.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (10 preceding siblings ...)
2024-04-15 8:26 ` cvs-commit at gcc dot gnu.org
@ 2024-04-24 13:46 ` ppalka at gcc dot gnu.org
2024-04-24 13:50 ` ppalka at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-24 13:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
--- Comment #12 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to m.cencora from comment #10)
> Created attachment 57924 [details]
> Full "std' modules with workarounds
>
> Here is an improved version of "std" module, with workarounds for:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114683
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114685
Interesting, thanks!
IIUC in light of these 'export using' bugs the most robust way to implement the
std module in GCC 14 is probably:
$ cat std.C
export module std;
export import <bits/stdc++.h>;
$ g++ -fmodules-ts -x c++-system-header bits/stdc++.h -x c++ std.C
This has the disadvantage of exposing implementation-detail entities and
requiring an additional step to build the <bits/stdc++.h> header module, but
should otherwise just work.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/114600] [14 Regression] [modules] redefinition errors when using certain std headers in GMF
2024-04-05 10:07 [Bug c++/114600] New: [modules] redefinition errors when using certain std headers in GMF m.cencora at gmail dot com
` (11 preceding siblings ...)
2024-04-24 13:46 ` ppalka at gcc dot gnu.org
@ 2024-04-24 13:50 ` ppalka at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-24 13:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114600
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #13 from Patrick Palka <ppalka at gcc dot gnu.org> ---
IIUC the regression is fixed.
^ permalink raw reply [flat|nested] 14+ messages in thread