Title
Certain hard-to-avoid errors not in the immediate context are not allowed to be triggered by the evaluation of type traits
Status
new
Section
[meta.unary.prop]
Submitter
Hubert Tong

Created on 2015-05-07.00:00:00 last changed 117 months ago

Messages

Date: 2015-05-07.00:00:00

I do not believe that the wording in [meta.unary.prop] paragraph 3 allows for the following program to be ill-formed:

#include <type_traits>

template <typename T> struct B : T { };
template <typename T> struct A { A& operator=(const B<T>&); };

std::is_assignable<A<int>, int> q;

In particular, I do not see where the wording allows for the "compilation of the expression" declval<T>() = declval<U>() to occur as a consequence of instantiating std::is_assignable<T, U> (where T and U are, respectively, A<int> and int in the example code).

Instantiating A<int> as a result of requiring it to be a complete type does not trigger the instantiation of B<int>; however, the "compilation of the expression" in question does.

History
Date User Action Args
2015-05-07 00:00:00admincreate