-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clang:modulesC++20 modules and Clang Header ModulesC++20 modules and Clang Header ModulesquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
With the following code,
module;
#include <utility>
export module test;
export namespace exported {
using ::std::tuple_element;
using ::std::tuple_size;
using ::std::integral_constant;
}#include <cstdint>
import test;
struct Foo {
template<std::size_t i>
int get() { return 0; }
};
template<>
struct exported::tuple_size<Foo> : exported::integral_constant<std::size_t, 1> {};
template<>
struct exported::tuple_element<0, Foo> { using type = int; };
void foo() {
auto [a] = Foo{};
}Clang produces the following diagnostic:
consumer.cpp:17:10: error: type 'Foo' decomposes into 0 elements, but 1 name was provided
17 | auto [a] = Foo{};
| ^
1 error generated.
as if it doesn't see tuple_size specialization. Note that the diagnostic goes away if I add
namespace std {
export using ::std::tuple_element;
export using ::std::tuple_size;
}to the module file. I'm not sure if this code is actually UB-free according to standard (it's definitely not when I start touching std namespace) but the current Clang behavior is very confusing.
Metadata
Metadata
Assignees
Labels
clang:modulesC++20 modules and Clang Header ModulesC++20 modules and Clang Header ModulesquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!