diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/SemaCXX/constexpr-backtrace-limit.cpp | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/SemaCXX/constexpr-backtrace-limit.cpp')
-rw-r--r-- | clang/test/SemaCXX/constexpr-backtrace-limit.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constexpr-backtrace-limit.cpp b/clang/test/SemaCXX/constexpr-backtrace-limit.cpp new file mode 100644 index 0000000..9c40eed --- /dev/null +++ b/clang/test/SemaCXX/constexpr-backtrace-limit.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit 0 -fconstexpr-depth 4 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST1 +// TEST1: constant expression +// TEST1-NEXT: exceeded maximum depth of 4 +// TEST1-NEXT: in call to 'recurse(2)' +// TEST1-NEXT: in call to 'recurse(3)' +// TEST1-NEXT: in call to 'recurse(4)' +// TEST1-NEXT: in call to 'recurse(5)' + +// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit 2 -fconstexpr-depth 4 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST2 +// TEST2: constant expression +// TEST2-NEXT: exceeded maximum depth of 4 +// TEST2-NEXT: in call to 'recurse(2)' +// TEST2-NEXT: skipping 2 calls +// TEST2-NEXT: in call to 'recurse(5)' + +// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit 2 -fconstexpr-depth 8 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST3 +// TEST3: constant expression +// TEST3-NEXT: reinterpret_cast +// TEST3-NEXT: in call to 'recurse(0)' +// TEST3-NEXT: skipping 4 calls +// TEST3-NEXT: in call to 'recurse(5)' + +// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -fconstexpr-backtrace-limit 8 -fconstexpr-depth 8 -fno-caret-diagnostics 2>&1 | FileCheck %s -check-prefix=TEST4 +// TEST4: constant expression +// TEST4-NEXT: reinterpret_cast +// TEST4-NEXT: in call to 'recurse(0)' +// TEST4-NEXT: in call to 'recurse(1)' +// TEST4-NEXT: in call to 'recurse(2)' +// TEST4-NEXT: in call to 'recurse(3)' +// TEST4-NEXT: in call to 'recurse(4)' +// TEST4-NEXT: in call to 'recurse(5)' + +constexpr int recurse(int n) { return n ? recurse(n-1) : *(int*)n; } +static_assert(recurse(5), ""); |