, f .
14.6.2.2 [temp.dep.expr]
3 id ,
, -: . U , , f<int> U(U) int(int). , , -, , , , .
. < >, , .
. .
, " T" T (14.5.1.3).
: .
, , f . :
14.6.2.1 [temp.dep.type]
5 ,
- , [...].
- , [...].
- , (5.2.5), [...].
: f , .
f , , f .
, , , , . , , ++. , , , :
#include <cstdio>
void f(const char *s, ...) { std::printf("%s: non-dependent\n", s); }
struct S1 { };
template <typename T>
struct S2 {
static S1 a;
static S1 b() { return {}; }
template <typename U>
static U c() { return {}; }
static void z() {
f("S1()", S1());
f("T()", T());
f("a", a);
f("b()", b());
f("c<T>()", c<T>());
f("c<S1>()", c<S1>());
f("decltype(b())()", decltype(b())());
}
};
void f(const char *s, S1) { std::printf("%s: dependent\n", s); }
template <>
S1 S2<S1>::b() { return {}; }
template <>
template <>
S1 S2<S1>::c<S1>() { return {}; }
int main() {
S2<S1>::z();
}
clang b(), decltype(b())() c<S1>() . . . , -, , S2<S1>::b S2<S1>::c<S1>, .