-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
Reproducer: https://godbolt.org/z/zG5jKc8ao
export module mod;
export auto f = [] {};
import mod;
int main ()
{
auto const g = f;
}
And it runs well if we changed the definition of f into export inline auto f = [] {};. Then I realized this may be related to ABI. Itanium C++ ABI 5.1.8 said:
In some contexts, such closure types are unique to the translation unit: This ABI therefore does not specify an encoding for such cases (but an implementation must ensure that any internal encoding does not conflict with this ABI).
In the following contexts, however, the one-definition rule requires closure types in different translation units to "correspond":
- default arguments appearing in class definitions
- default member initializers
- the bodies of inline or templated functions
- the initializers of inline or templated variables
So in the above example, the two different TU should share the same lambda type and so maybe we need to change the wording here.
Metadata
Metadata
Assignees
Labels
No labels