diff options
| author | Douglas Gregor <dgregor@apple.com> | 2013-01-29 01:26:43 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2013-01-29 01:26:43 +0000 |
| commit | 0b7bc7f99612e150304b83c5149b220b959b7341 (patch) | |
| tree | 72dc135f9a071c2a1e589fe5136d6733e97fcaf8 /clang/test | |
| parent | 0cdcc98200b8b2c0dea21bae433677f88aae597c (diff) | |
| download | bcm5719-llvm-0b7bc7f99612e150304b83c5149b220b959b7341.tar.gz bcm5719-llvm-0b7bc7f99612e150304b83c5149b220b959b7341.zip | |
Don't crash while printing APValues that are lvalues casted to a
decidedly non-reference, non-pointer type. Fixes <rdar://problem/13090123>.
llvm-svn: 173747
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CXX/expr/expr.const/p2-0x.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CXX/expr/expr.const/p2-0x.cpp b/clang/test/CXX/expr/expr.const/p2-0x.cpp index 9e6716d0b8e..065a12b3f23 100644 --- a/clang/test/CXX/expr/expr.const/p2-0x.cpp +++ b/clang/test/CXX/expr/expr.const/p2-0x.cpp @@ -594,3 +594,16 @@ static const bool or_value = and_or<true>::or_value; static_assert(and_value == false, ""); static_assert(or_value == true, ""); + +namespace rdar13090123 { + typedef __INTPTR_TYPE__ intptr_t; + + constexpr intptr_t f(intptr_t x) { + return (((x) >> 21) * 8); // expected-note{{subexpression not valid in a constant expression}} + } + + extern "C" int foo; + + constexpr intptr_t i = f((intptr_t)&foo - 10); // expected-error{{constexpr variable 'i' must be initialized by a constant expression}} \ + // expected-note{{in call to 'f((char*)&foo + -10)'}} +} |

