summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/lambda-expressions.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-24 22:12:32 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-24 22:12:32 +0000
commit6365c9138e26add7d5ee99b74ad4edd309024c3c (patch)
tree12cf6da28b78c96389bd668c2c5e732a9edc3bf3 /clang/test/SemaCXX/lambda-expressions.cpp
parent9fceb90175f1fd40ab69015e18804d5d78781ffd (diff)
downloadbcm5719-llvm-6365c9138e26add7d5ee99b74ad4edd309024c3c.tar.gz
bcm5719-llvm-6365c9138e26add7d5ee99b74ad4edd309024c3c.zip
When checking whether a reference to a variable is an ICE, look at the type of
the declaration, not at the type of the DeclRefExpr, since within a lambda the DeclRefExpr can be more const than the declaration is. llvm-svn: 151399
Diffstat (limited to 'clang/test/SemaCXX/lambda-expressions.cpp')
-rw-r--r--clang/test/SemaCXX/lambda-expressions.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp
index 1358d9e2a39..e1b0f49cc8d 100644
--- a/clang/test/SemaCXX/lambda-expressions.cpp
+++ b/clang/test/SemaCXX/lambda-expressions.cpp
@@ -101,3 +101,30 @@ namespace PR12031 {
f(v, [](){});
}
}
+
+namespace NullPtr {
+ int &f(int *p);
+ char &f(...);
+ void g() {
+ int n = 0;
+ [=] {
+ char &k = f(n); // not a null pointer constant
+ } ();
+
+ const int m = 0;
+ [=] {
+ int &k = f(m); // a null pointer constant
+ } ();
+
+ // FIXME: At least the second of these cases should probably not be
+ // considered to be a null pointer constant.
+ [=] () -> bool {
+ int &k = f(m); // a null pointer constant?
+ return &m == 0; // no, captured!
+ } ();
+
+ [m] {
+ int &k = f(m); // a null pointer constant?
+ } ();
+ }
+}
OpenPOWER on IntegriCloud