diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-29 00:03:08 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-29 00:03:08 +0000 |
commit | 839046a8c5f890f172b0a172ed6ec9e7d0275f2e (patch) | |
tree | 5d052f72af48995ebb333e2e40b1fa6387699325 | |
parent | fab8d5b478e6fb112b4414c4698a7cc2a350b0f0 (diff) |
Add test missed from r143234.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143257 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp new file mode 100644 index 0000000000..c3c69c465f --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +namespace StdExample { + +constexpr int f(void *) { return 0; } +constexpr int f(...) { return 1; } +constexpr int g1() { return f(0); } +constexpr int g2(int n) { return f(n); } +constexpr int g3(int n) { return f(n*0); } + +namespace N { + constexpr int c = 5; + constexpr int h() { return c; } +} +constexpr int c = 0; +constexpr int g4() { return N::h(); } + +// FIXME: constexpr calls aren't recognized as ICEs yet, just as foldable. +#define JOIN2(a, b) a ## b +#define JOIN(a, b) JOIN2(a, b) +#define CHECK(n, m) using JOIN(A, __LINE__) = int[n]; using JOIN(A, __LINE__) = int[m]; +CHECK(f(0), 0) +CHECK(f('0'), 1) +CHECK(g1(), 0) +CHECK(g2(0), 1) +CHECK(g2(1), 1) +CHECK(g3(0), 1) +CHECK(g3(1), 1) +CHECK(N::h(), 5) +CHECK(g4(), 5) + +} |