-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++20] [Modules] The constructor of lambda is broken after deserialization #59513
Comments
@llvm/issue-subscribers-c-20 |
@llvm/issue-subscribers-clang-modules |
Shouldn't |
Thanks. I just verified it still exists on trunk with the updated reproducer. |
@ChuanqiXu9 This issue is titled with a reference to serialization/deserialization, do you suspect that the serialization functionality itself is involved in the problem? After dumping the clang AST from the primary module interface unit and from the downstream dependent TU (with I'm thinking this is deeper in the "Sema" system, but please let me know if you think I might be down the wrong path. |
@Bigcheese, as you noted, it doesn’t seem like the original reproducer before Chuanqi's edit was actually expected to be acceptable code judging by https://eel.is/c++draft/module.global.frag#4, and I think it shows there’s another related issue that could cause invalid code being accepted, demonstrated (leading to a bad diagnostic) with the following: // RUN: rm -rf %t
// RUN: mkdir %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/A.cppm -o %t/A.pcm -verify
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/useA.cpp -fsyntax-only -verify
//--- global.h
namespace foo {
int x = 42;
}
//--- A.cppm
// expected-no-diagnostics
module;
#include "global.h"
export module A;
//--- useA.cpp
// expected-no-diagnostics
import A;
namespace foo {
double x = 99.9;
}
Is this worth filing separately? |
No, it was my direct feelings when seeing the problem. I never looked into it. And I feel it might be a Sema issues too. |
I guess you're saying valid being rejected? And this is a known issue that we didn't implement discarding unreachable things in GMFs. I have a draft on this: #76930 |
The visibility issue is definitely separate, and different from not including things the the PCM, as there are cases where we do need to include entities in the GMF in the PCM, but they still need to not be visible. I think visibility to name lookup should be handled the same way that it's handled for submodules under local submodule visibility (LSV) (but don't actually require LSV). We can ignore visibility for this issue, and just focus on the updated testcase which definitely should work. |
Yeah, the visibility problem is complex (although I don't feel we can't handle this with LSV). Let's ignore that problem in this issue. |
@ChuanqiXu9 Does this issue also prevent restoring the lambda for
as per the Standard (the workaround for modules introduced here https://reviews.llvm.org/D146545) as discussed here: #57222 (comment) (in #57222), |
I feel this may not be a blocker for that since the error message are different. I think it maybe worth a try to see if the issue is still exist in libc++. |
Simpler reproducer: https://godbolt.org/z/zG5jKc8ao
|
I just realized this may be related to the ABI issue: itanium-cxx-abi/cxx-abi#186 |
Restore `__synth_three_way` lambda to match the Standard. GH-57222 is done, restoring the Standard wording implementation should be possible. https://github.com/llvm/llvm-project/blob/df28d4412c1d21b0e18896c92ac77d2fac7729f1/libcxx/include/__compare/synth_three_way.h#L28 According to comment #59513 (comment), GH-59513 is not a blocker. Co-authored-by: Hristo Hristov <[email protected]>
Reproducer:
Compile it with:
It would emit the following errors:
The text was updated successfully, but these errors were encountered: