aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.const
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-12-16 19:06:07 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-12-16 19:06:07 +0000
commit08d6e032a2a0a8656d12b3b7b93942987bb12eb7 (patch)
tree632b74cc7329419d23c53cb941e19ed16a587d5b /test/CXX/expr/expr.const
parentd3d8548e75f3fb6db53ed0927c1df30d78f4ce1d (diff)
C++11 constexpr: Add note stacks containing backtraces if constant evaluation
fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit argument to driver and frontend, to control the maximum number of notes so produced (default 10). Fix APValue printing to be able to pretty-print all APValue types, and move the testing for this functionality from a unittest to a -verify test now that it's visible in clang's output. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146749 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.const')
-rw-r--r--test/CXX/expr/expr.const/p2-0x.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp
index 2e5e7f2ca4..0e6d69dd12 100644
--- a/test/CXX/expr/expr.const/p2-0x.cpp
+++ b/test/CXX/expr/expr.const/p2-0x.cpp
@@ -56,7 +56,7 @@ namespace NonConstExprReturn {
return n; // expected-note {{reference to temporary cannot be returned from a constexpr function}}
}
struct NonConstExprFunction {
- int n : id_ref( // expected-error {{constant expression}}
+ int n : id_ref( // expected-error {{constant expression}} expected-note {{in call to 'id_ref(16)'}}
16 // expected-note {{temporary created here}}
);
};
@@ -64,10 +64,10 @@ namespace NonConstExprReturn {
return &a; // expected-note {{pointer to 'n' cannot be returned from a constexpr function}}
}
constexpr const int *return_param(int n) { // expected-note {{declared here}}
- return address_of(n);
+ return address_of(n); // expected-note {{in call to 'address_of(n)'}}
}
struct S {
- int n : *return_param(0); // expected-error {{constant expression}}
+ int n : *return_param(0); // expected-error {{constant expression}} expected-note {{in call to 'return_param(0)'}}
};
}
@@ -87,7 +87,7 @@ namespace NonConstExprCtor {
constexpr T t2(0); // expected-error {{must be initialized by a constant expression}}
struct S {
- int n : T(4).r; // expected-error {{constant expression}} expected-note {{temporary created here}}
+ int n : T(4).r; // expected-error {{constant expression}} expected-note {{temporary created here}} expected-note {{in call to 'T(4)'}}
};
}
@@ -95,17 +95,17 @@ namespace NonConstExprCtor {
// exceed the implementation-defined recursion limits (see Annex B);
namespace RecursionLimits {
constexpr int RecurseForever(int n) {
- return n + RecurseForever(n+1); // expected-note {{constexpr evaluation exceeded maximum depth of 256 calls}}
+ return n + RecurseForever(n+1); // expected-note {{constexpr evaluation exceeded maximum depth of 256 calls}} expected-note 9{{in call to 'RecurseForever(}} expected-note {{skipping 246 calls}}
}
struct AlsoRecurseForever {
constexpr AlsoRecurseForever(int n) :
- n(AlsoRecurseForever(n+1).n) // expected-note {{constexpr evaluation exceeded maximum depth of 256 calls}}
+ n(AlsoRecurseForever(n+1).n) // expected-note {{constexpr evaluation exceeded maximum depth of 256 calls}} expected-note 9{{in call to 'AlsoRecurseForever(}} expected-note {{skipping 246 calls}}
{}
int n;
};
struct S {
- int k : RecurseForever(0); // expected-error {{constant expression}}
- int l : AlsoRecurseForever(0).n; // expected-error {{constant expression}}
+ int k : RecurseForever(0); // expected-error {{constant expression}} expected-note {{in call to}}
+ int l : AlsoRecurseForever(0).n; // expected-error {{constant expression}} expected-note {{in call to}}
};
}
@@ -135,7 +135,7 @@ namespace UndefinedBehavior {
return q[0]; // expected-note {{dereferenced pointer past the end of subobject of 's' is not a constant expression}}
}
struct T {
- int n : f(p); // expected-error {{not an integer constant expression}}
+ int n : f(p); // expected-error {{not an integer constant expression}} expected-note {{in call to 'f(&s.m + 1)'}}
};
}