aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp8
-rw-r--r--test/CodeGenCXX/const-init.cpp7
-rw-r--r--test/SemaCXX/constant-expression-cxx11.cpp4
3 files changed, 16 insertions, 3 deletions
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
index f7da24dfc2..51a062d866 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
@@ -1,13 +1,17 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct S {
- constexpr void f();
- constexpr void g() const;
+ constexpr int f();
+ constexpr int g() const;
+ static constexpr int Sf();
};
void f(const S &s) {
s.f();
s.g();
+
+ int (*f)() = &S::Sf;
+ int (S::*g)() const = &S::g;
}
namespace std_example {
diff --git a/test/CodeGenCXX/const-init.cpp b/test/CodeGenCXX/const-init.cpp
index f06e546ec9..1fc3deba41 100644
--- a/test/CodeGenCXX/const-init.cpp
+++ b/test/CodeGenCXX/const-init.cpp
@@ -29,12 +29,17 @@ namespace test2 {
struct A {
static const double d = 1.0;
static const float f = d / 2;
- };
+ static int g();
+ } a;
// CHECK: @_ZN5test22t0E = global double {{1\.0+e\+0+}}, align 8
// CHECK: @_ZN5test22t1E = global [2 x double] [double {{1\.0+e\+0+}}, double {{5\.0+e-0*}}1], align 16
+ // CHECK: @_ZN5test22t2E = global double* @_ZN5test21A1d
+ // CHECK: @_ZN5test22t3E = global {{.*}} @_ZN5test21A1g
double t0 = A::d;
double t1[] = { A::d, A::f };
+ const double *t2 = &a.d;
+ int (*t3)() = &a.g;
}
// We don't expect to fold this in the frontend, but make sure it doesn't crash.
diff --git a/test/SemaCXX/constant-expression-cxx11.cpp b/test/SemaCXX/constant-expression-cxx11.cpp
index 71a98a5fcf..d208362cbc 100644
--- a/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/test/SemaCXX/constant-expression-cxx11.cpp
@@ -187,6 +187,10 @@ namespace StaticMemberFunction {
static_assert_fold(S::f(19) == 800, "");
static_assert_fold(s.f(19) == 800, "");
static_assert_fold(n == 800, "");
+
+ constexpr int (*sf1)(int) = &S::f;
+ constexpr int (*sf2)(int) = &s.f;
+ constexpr const int *sk = &s.k;
}
namespace ParameterScopes {