return false;
}
+template <class Emitter>
+bool ByteCodeExprGen<Emitter>::VisitTypeTraitExpr(const TypeTraitExpr *E) {
+ return this->emitConstBool(E->getValue(), E);
+}
+
template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
if (E->containsErrors())
return false;
bool VisitExprWithCleanups(const ExprWithCleanups *E);
bool VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E);
bool VisitCompoundLiteralExpr(const CompoundLiteralExpr *E);
+ bool VisitTypeTraitExpr(const TypeTraitExpr *E);
protected:
bool visitExpr(const Expr *E) override;
static_assert(get3() == 3, "");
#endif
};
+
+namespace TypeTraits {
+ static_assert(__is_trivial(int), "");
+ static_assert(__is_trivial(float), "");
+ static_assert(__is_trivial(E), "");
+ struct S{};
+ static_assert(__is_trivial(S), "");
+ struct S2 {
+ S2() {}
+ };
+ static_assert(!__is_trivial(S2), "");
+
+ template <typename T>
+ struct S3 {
+ constexpr bool foo() const { return __is_trivial(T); }
+ };
+ struct T {
+ ~T() {}
+ };
+ struct U {};
+ static_assert(S3<U>{}.foo(), "");
+ static_assert(!S3<T>{}.foo(), "");
+}