-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[C++23] [Modules] module before include will have a "redefinition of concept" error #91111
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
Comments
@llvm/issue-subscribers-clang-frontend Author: None (ncihnegn)
Similar to #87609.
LLVM: 18.1.5 Demo: https://github.com/ncihnegn/cpp-modules-demo
|
@llvm/issue-subscribers-clang-modules Author: None (ncihnegn)
Similar to #87609.
LLVM: 18.1.5 Demo: https://github.com/ncihnegn/cpp-modules-demo
|
This looks similar with #87609. Have you tested on trunk? |
I observed this same problem earlier today with the same OS and Clang version. I can confirm that Clang trunk fixes this problem! |
Thanks. Then I'd like to close the issue. |
Sorry to bother, but I've met the same problem with clang 18.1.8 (which should already cover the trunk, according to the date of comment). LLVM: 18.1.8 from MacPorts // info.cppm
module;
#include <future>
#include <map>
export module info;
export void func()
{
}
// main.cpp
import info;
#include <optional> [build] /opt/local/bin/c++ -DNAPI_VERSION=8 -DNODE_ADDON_API_ENABLE_TYPE_CHECK_ON_AS -Dmaa_EXPORTS -I/Users/nekosu/Documents/Projects/MAA/maa-node/node_modules/node-api-headers/include -I/Users/nekosu/Documents/Projects/MAA/maa-node/node_modules/node-addon-api -isystem /Users/nekosu/Documents/Projects/MAA/maa-node/maa/include -D_DARWIN_USE_64_BIT_INODE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILDING_NODE_EXTENSION -g -std=gnu++20 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -fPIC -MD -MT CMakeFiles/maa.dir/src_new/main.cpp.o -MF CMakeFiles/maa.dir/src_new/main.cpp.o.d @CMakeFiles/maa.dir/src_new/main.cpp.o.modmap -o CMakeFiles/maa.dir/src_new/main.cpp.o -c /Users/nekosu/Documents/Projects/MAA/maa-node/src_new/main.cpp
[build] In file included from /Users/nekosu/Documents/Projects/MAA/maa-node/src_new/main.cpp:3:
[build] /opt/local/libexec/llvm-18/bin/../include/c++/v1/optional:571:9: error: redefinition of concept '__is_derived_from_optional' with different template parameters or requirements
[build] 571 | concept __is_derived_from_optional = requires(const _Tp& __t) { []<class _Up>(const optional<_Up>&) {}(__t); };
[build] | ^
[build] /opt/local/libexec/llvm-18/bin/../include/c++/v1/__ranges/movable_box.h:23:10: note: '/opt/local/libexec/llvm-18/bin/../include/c++/v1/optional' included multiple times, additional include site in header from module 'info.<global>'
[build] 23 | #include <optional>
[build] | ^
[build] /Users/nekosu/Documents/Projects/MAA/maa-node/src_new/include/info.cppm:1:1: note: info.<global> defined here
[build] 1 | module;
[build] | ^
[build] /Users/nekosu/Documents/Projects/MAA/maa-node/src_new/main.cpp:3:10: note: '/opt/local/libexec/llvm-18/bin/../include/c++/v1/optional' included multiple times, additional include site here
[build] 3 | #include <optional>
[build] | ^
[build] In file included from /Users/nekosu/Documents/Projects/MAA/maa-node/src_new/main.cpp:3:
[build] /opt/local/libexec/llvm-18/bin/../include/c++/v1/optional:1240:13: error: use of undeclared identifier '__is_derived_from_optional'
[build] 1240 | requires(!__is_derived_from_optional<_Up>) && three_way_comparable_with<_Tp, _Up>
[build] | ^
[build] 2 errors generated.
[build] ninja: build stopped: subcommand failed. nekosu@NEKOSULIAO-MC0 /Users/nekosu/Documents/Projects/MAA/maa-node % /opt/local/bin/c++ -v
clang version 18.1.8
Target: x86_64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-18/bin |
I took a quick check and it looks like the fix was not backported to 18.x. Would you like to test on trunk? |
I'll try it later, as building trunk does take quite a long time. |
Similar to #87609.
LLVM: 18.1.5
OS: macOS Sonoma 14.4.1
CPU: Apple M1
Demo: https://github.com/ncihnegn/cpp-modules-demo
The text was updated successfully, but these errors were encountered: