-
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
[clangd][modules] Clangd reports ODR violation when including iostream from (global module fragment of) two different modules #100924
Comments
Could be related to #58540, although there the discussion is about importing header units. |
Ah upon closer examination seems to be same as #78850 That said, I thought the |
@llvm/issue-subscribers-clang-modules Author: Arsen Kitov (alfaix)
Hey, I'm trying to get modules to work with clangd following [this PR](https://github.com//pull/66462).
However, when I run // b.cppm
module;
#include <iostream>
export module b;
export template <class T>
concept C = requires() {
{ T::foo } -> std::convertible_to<int>;
};
// c.cppm
module;
#include <iostream>
export module c;
import b;
class B {
public:
static constexpr int foo = 1;
};
export template <class T>
requires C<T>
class D {};
int main() { D<B> s; } Put The setup is sensitive to small changes - e.g., removing std::convertible from the concept leads to the error disappearing. I put the repro in a small repo for convenience. Tested with |
@llvm/issue-subscribers-clangd Author: Arsen Kitov (alfaix)
Hey, I'm trying to get modules to work with clangd following [this PR](https://github.com//pull/66462).
However, when I run // b.cppm
module;
#include <iostream>
export module b;
export template <class T>
concept C = requires() {
{ T::foo } -> std::convertible_to<int>;
};
// c.cppm
module;
#include <iostream>
export module c;
import b;
class B {
public:
static constexpr int foo = 1;
};
export template <class T>
requires C<T>
class D {};
int main() { D<B> s; } Put The setup is sensitive to small changes - e.g., removing std::convertible from the concept leads to the error disappearing. I put the repro in a small repo for convenience. Tested with |
Would you like to test again on trunk? |
Hey, I'm trying to get modules to work with clangd following this PR.
However, when I run
clangd
with the following files:Put
-std=c++23 -stdlib=libc++
and all the-fmodule
things incompile_commands.json
, clangd reports an ODR violation, saying the 2 definitions ofstd::error_category
from the 2 includes are different:E[12:04:26.095] [module_odr_violation_missing_decl] Line 3: in included file: 'std::error_category::message' from module '' is not present in definition of 'std::error_category' in module 'b.<global>'
The setup is sensitive to small changes - e.g., removing std::convertible from the concept leads to the error disappearing. I put the repro in a small repo for convenience.
Tested with
Ubuntu clang version 20.0.0 (++20240727042143+9a3e66e314e6-1~exp1~20240727042317.1828)
straight out of apt.llvm.org snapshot repo.The text was updated successfully, but these errors were encountered: