-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Description
I ran into this problem with mdspan layouts, when I tried to rely on the implicitly defined deduction guides.
That works but produces a warning with -Wctad-maybe-unsupported
on the compile line.
It was suggested to use _LIBCPP_CTAD_SUPPORTED_FOR_TYPE
but that gives a compile error: https://godbolt.org/z/7n48snYfb
Adding the deduction guide explicitly in the layout_left
class leads to this warning:
__fwd/mdspan.h:55:3: error: unused function template '<deduction guide for mapping>' [-Werror,-Wunused-template]
55 | mapping(_Extents, array<_OtherIndexType, _Extents::rank>) -> mapping<_Extents>;
which I can silence with a [[maybe_unused]]
, that however leads to a compile error with GCC: https://godbolt.org/z/69xEqavGv
Here is the code reproducer:
#include <__config>
#include<array>
struct layout_left {
template<class E>
struct mapping;
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(mapping);
};
template<class E>
struct layout_left::mapping {
template<class T>
mapping(E e, std::array<T, 1> a) {}
};
void func() {
layout_left::mapping m(5, std::array<int,1>{1});
}
Metadata
Metadata
Assignees
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.