summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2019-08-09 17:42:41 +0000
committerGabor Horvath <xazax.hun@gmail.com>2019-08-09 17:42:41 +0000
commit2bf522aea62e4fb653cacb68072167d25149099e (patch)
treeee2050bab03376b869b4f6e79688f864817b8285 /clang/test/Sema
parent1c5542aa9d65dbc345e90802ba6966ba31a98f45 (diff)
downloadbcm5719-llvm-2bf522aea62e4fb653cacb68072167d25149099e.tar.gz
bcm5719-llvm-2bf522aea62e4fb653cacb68072167d25149099e.zip
Fix a build bot failure and multiple warnings instances for range base for loops
llvm-svn: 368459
Diffstat (limited to 'clang/test/Sema')
-rw-r--r--clang/test/Sema/warn-lifetime-analysis-nocfg.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/Sema/warn-lifetime-analysis-nocfg.cpp b/clang/test/Sema/warn-lifetime-analysis-nocfg.cpp
index efa54fe662b..eaddb74e5a3 100644
--- a/clang/test/Sema/warn-lifetime-analysis-nocfg.cpp
+++ b/clang/test/Sema/warn-lifetime-analysis-nocfg.cpp
@@ -201,6 +201,13 @@ void danglingReferenceFromTempOwner() {
std::vector<int> getTempVec();
std::optional<std::vector<int>> getTempOptVec();
+void testLoops() {
+ for (auto i : getTempVec()) // ok
+ ;
+ for (auto i : *getTempOptVec()) // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}}
+ ;
+}
+
int &usedToBeFalsePositive(std::vector<int> &v) {
std::vector<int>::iterator it = v.begin();
int& value = *it;
OpenPOWER on IntegriCloud