diff --git a/Makefile b/Makefile index d95660f..2d64919 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SRC=$(EXE).cpp shunting-yard.cpp packToken.cpp functions.cpp catch.cpp OBJ=$(SRC:.cpp=.o) CXX=g++ -CFLAGS=-g -Wall -pedantic #-DDEBUG +CFLAGS=-std=c++0x -g -Wall -pedantic #-DDEBUG all: $(EXE) $(EXE): $(OBJ); $(CXX) $(CFLAGS) $(OBJ) -o $(EXE) diff --git a/shunting-yard.h b/shunting-yard.h index 9ee30e5..9224170 100644 --- a/shunting-yard.h +++ b/shunting-yard.h @@ -40,8 +40,8 @@ struct Scope { typedef std::list Scope_t; mutable Scope_t scope; - Scope() {} Scope(TokenMap_t* vars); + Scope() : Scope(0) {} packToken* find(std::string key) const; void asign(std::string key, TokenBase* value) const; diff --git a/test-shunting-yard.cpp b/test-shunting-yard.cpp index 1f48152..677a4cd 100644 --- a/test-shunting-yard.cpp +++ b/test-shunting-yard.cpp @@ -131,6 +131,8 @@ TEST_CASE("Scope management") { scope.pop(); scope.pop(); + scope.pop(); // Final pop for default functions. + // Test what happens when you try to drop more namespaces than possible: REQUIRE_THROWS(scope.pop());