2496. Certain hard-to-avoid errors not in the immediate context are not allowed to be triggered by the evaluation of type traits

Section: [meta.unary.prop] Status: New Submitter: Hubert Tong Opened: 2015-05-07 Last modified: 2015-08-17

Priority: 3

View other active issues in [meta.unary.prop].

View all other issues in [meta.unary.prop].

View all issues with New status.


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.

Proposed resolution: