Consider the following snippet:
struct Base { };
struct Derived : Base { };
void f(Base &) { std::cout << \"f(Base&)\\n\"; }
template
I think gcc (and visual studio, by the way) are right on this one.
n4582, §14.6.2.2
Except as described below, an expression is type-dependent if any subexpression is type-dependent.
In T{} ? d : d
, there are 3 sub expressions:
T{}
, obviously type dependentd
(2 times), not type dependentSince there is a type dependent sub expression and the ternary operator does not figure in the list of exceptions in §14.6.2.2, it is considered type dependent.