[cfe-commits] r113625 - /cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Fri Sep 10 13:55:50 PDT 2010


Author: cornedbee
Date: Fri Sep 10 15:55:50 2010
New Revision: 113625

URL: http://llvm.org/viewvc/llvm-project?rev=113625&view=rev
Log:
Tests for noexcept in templates.

Modified:
    cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp

Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp?rev=113625&r1=113624&r2=113625&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp Fri Sep 10 15:55:50 2010
@@ -2,6 +2,7 @@
 
 #define P(e) static_assert(noexcept(e), "expected nothrow")
 #define N(e) static_assert(!noexcept(e), "expected throw")
+#define B(b, e) static_assert(b == noexcept(e), "expectation failed")
 
 void simple() {
   P(0);
@@ -126,3 +127,33 @@
   P(sizeof(typeid(*(V*)0)));
   P(typeid(typeid(*(V*)0)));
 }
+
+struct G1 {};
+struct G2 { int i; };
+struct G3 { S2 s; };
+
+void gencon() {
+  P(G1());
+  P(G2());
+  N(G3());
+}
+
+template <typename T, bool b>
+void late() {
+  B(b, typeid(*(T*)0));
+  B(b, T(1));
+  B(b, static_cast<T>(S2(0, 0)));
+  B(b, S1() + T());
+}
+struct S3 {
+  virtual ~S3() throw();
+  S3() throw();
+  explicit S3(int);
+  S3(const S2&);
+};
+void operator +(const S1&, float) throw();
+void operator +(const S1&, const S3&);
+void tlate() {
+  late<float, true>();
+  late<S3, false>();
+}





More information about the cfe-commits mailing list