summaryrefslogtreecommitdiffstats
path: root/Source/cmFunctionCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-18 14:31:42 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-18 15:13:05 (GMT)
commit3a65606591818281ba75bac4751e07c69751451f (patch)
treea3615f48210101feb8cab81d26707f404bce94c5 /Source/cmFunctionCommand.cxx
parent91d5261b58e97107fca610a868fbc283cbb8c856 (diff)
downloadCMake-3a65606591818281ba75bac4751e07c69751451f.zip
CMake-3a65606591818281ba75bac4751e07c69751451f.tar.gz
CMake-3a65606591818281ba75bac4751e07c69751451f.tar.bz2
Fix assertion failure on unmatched foreach in function (#15572)
The lexical scope counting added by commit v3.2.0-rc1~332^2~1 (Track nested loop levels in CMake language with a stack of counters, 2014-11-18) forgot to account for scopes popped by error messages about unclosed scopes. Teach the error handler to pop the lexical scope it reports as unclosed. Re-order the lexical scope RAII object to be inside the variable scope RAII object scope so that the lexical scope is fully closed before we check assertions about variable scopes. Extend the RunCMake.Syntax test with a case covering this.
Diffstat (limited to 'Source/cmFunctionCommand.cxx')
-rw-r--r--Source/cmFunctionCommand.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index c33048c..4a0efc1 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -94,8 +94,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass
}
// we push a scope on the makefile
- cmMakefile::LexicalPushPop lexScope(this->Makefile);
cmMakefile::ScopePushPop varScope(this->Makefile);
+ cmMakefile::LexicalPushPop lexScope(this->Makefile);
static_cast<void>(varScope);
// Push a weak policy scope which restores the policies recorded at