You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to commit 2aa1056, the Destructible concept was defined in terms of std::is_destructible. Following that commit, it is defined using a requires expression that uses an explicit destructor call and requires that a pointer to the type can be constructed.
The current Destructible concept fails for some types that are destructible according to the libstdc++ std::is_destructible implementation; specifically for reference types and arrays of known bound. The following example demonstrates this:
$ cat destructible.cpp
#include<type_traits>template<typename T>
concept boolDestructible()
{
#if USE_IS_DESTRUCTIBLE
return std::is_destructible<T>::value;
#elsereturnrequires (T* t) { t->~T(); };
#endif
}
template<Destructible T>
voidf();
voidbar() {
f<char[5]>(); // constraints not satisfied; ok with is_destructible
f<int&>(); // constraints not satisfied; ok with is_destructible
}
destructible.cpp: In function ‘void bar()’:
destructible.cpp:18:16: error: cannot call function ‘void f() [with T = char [5]]’
f<char[5]>(); // constraints not satisfied; ok with is_destructible
^
destructible.cpp:15:6: note: constraints not satisfied
void f();
^
destructible.cpp:15:6: note: concept ‘Destructible<char [5]>()’ was not satisfied
destructible.cpp:19:13: error: cannot call function ‘void f() [with T = int&]’
f<int&>(); // constraints not satisfied; ok with is_destructible
^
destructible.cpp:15:6: note: constraints not satisfied
void f();
^
destructible.cpp:15:6: note: concept ‘Destructible<int&>()’ was not satisfied
I don't know what motivated the change to the Destructible concept definition. Unless there is good reason to avoid std::is_destructible, I recommend reverting the change to the concept definition.
Commit 2aa1056 changed Origin's
definition of the Destructible concept in terms of the validity
or a pseudo destructor expression rather than std::is_destructible.
That change resulted in reference and array of known bound types
failing to model the Destructible concept as required by C++14 via
the resolution of DR 2049 [1]. This regression is tracked at [2].
This change reverts the change made to the Destructible concept in
that commit.
[1]: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2049
[2]: asutton#5
Prior to commit 2aa1056, the Destructible concept was defined in terms of std::is_destructible. Following that commit, it is defined using a requires expression that uses an explicit destructor call and requires that a pointer to the type can be constructed.
The current Destructible concept fails for some types that are destructible according to the libstdc++ std::is_destructible implementation; specifically for reference types and arrays of known bound. The following example demonstrates this:
$ cat destructible.cpp
$ g++ -c -std=c++1z -DUSE_IS_DESTRUCTIBLE destructible.cpp
$ g++ -c -std=c++1z destructible.cpp
I don't know what motivated the change to the Destructible concept definition. Unless there is good reason to avoid std::is_destructible, I recommend reverting the change to the concept definition.
Relevant C++ DRs:
The text was updated successfully, but these errors were encountered: