-
Notifications
You must be signed in to change notification settings - Fork 12k
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] error: 'std::align_val_t' has different definitions in different modules #76638
Comments
@llvm/issue-subscribers-clang-modules Author: Ivan171 (Ivan171)
I could not create a minimal reproducer, but I've attached the preprocessed files, which I think is enough to reproduce the issue.
EnvironmentWindows 10 Reproducer// mod2.cpp
module;
#include <utility>
export module mod2; // mod1.cpp
module;
#include <memory>
export module mod1;
import mod2;
|
Does compiling with |
Yes |
Oh, sad. This has the same error message with #60027... |
Here is a reduced reproducer: // mod1.cpp
module;
extern "C" {
typedef unsigned __int64 size_t;
}
namespace std {
enum class align_val_t : size_t {};
}
export module mod1;
import mod2; // mod2.cpp
module;
extern "C" {
typedef unsigned __int64 size_t;
}
namespace std {
using :: size_t;
}
extern "C++" {
namespace std {
enum class align_val_t : size_t {};
}
}
export module mod2; Seems similar to the reproducer provided by @davidstone: #60027 (comment) |
This is slightly more tricky than I thought. The reduced example can be accepted by using the canonical decl for the integral type for enum decl here: llvm-project/clang/lib/AST/ODRHash.cpp Lines 744 to 745 in d02c793
However, this may introduce false-negative issues. Now the following case will be accepted: // mod1.cpp
module;
extern "C" {
typedef unsigned __int64 size_t;
}
namespace std {
enum class align_val_t : size_t {};
} export module mod1;
import mod2;
// mod2.cpp
module;
extern "C" {
typedef unsigned __int64 size_t;
}
namespace std {
using :: size_t;
}
extern "C++" {
namespace std {
enum class align_val_t : std::size_t {};
}
}
export module mod2; Now the spellings of the definition of
Also my "fix" only works for the reported enum case, but I believe the similar problem can occur in other places. @zygoloid Can you take a look about how should we proceed here? |
Given the reported issue has a stronger impact (we've seen multiple reports about it) and the down side of the proposed solution may only be a concern, I'd like to land the proposed solution in a few days if no more comments come in. |
…ger types Close llvm#76638. See the issue for the context of the change.
My original issue is fixed, but now I've ran into the following issue #79386, which seems to have the same underlying problem. |
Previosly we land llvm@085eae6 to workaround the false positive ODR violations in llvm#76638. However, we decided to not perform ODR checks for decls from GMF in llvm#79240 and we land the corresponding change. So we should be able to remove the workaround now. The original tests get remained.
Previosly we land llvm@085eae6 to workaround the false positive ODR violations in llvm#76638. However, we decided to not perform ODR checks for decls from GMF in llvm#79240 and we land the corresponding change. So we should be able to remove the workaround now. The original tests get remained.
Previosly we land llvm@085eae6 to workaround the false positive ODR violations in llvm#76638. However, we decided to not perform ODR checks for decls from GMF in llvm#79240 and we land the corresponding change. So we should be able to remove the workaround now. The original tests get remained.
Previosly we land llvm@085eae6 to workaround the false positive ODR violations in llvm#76638. However, we decided to not perform ODR checks for decls from GMF in llvm#79240 and we land the corresponding change. So we should be able to remove the workaround now. The original tests get remained.
Previosly we land llvm@085eae6 to workaround the false positive ODR violations in llvm#76638. However, we decided to not perform ODR checks for decls from GMF in llvm#79240 and we land the corresponding change. So we should be able to remove the workaround now. The original tests get remained.
Previosly we land llvm@085eae6 to workaround the false positive ODR violations in llvm#76638. However, we decided to not perform ODR checks for decls from GMF in llvm#79240 and we land the corresponding change. So we should be able to remove the workaround now. The original tests get remained.
I could not create a minimal reproducer, but I've attached the preprocessed files, which I think is enough to reproduce the issue.
Environment
Windows 10
Clang 18.0.0git (https://github.com/llvm/llvm-project 85c3953)
MSVC 2022 (17.8.1)
Reproducer
The text was updated successfully, but these errors were encountered: