From 6533f45d82e6049c29c5d1dab0d811f1f1f1a081 Mon Sep 17 00:00:00 2001 From: Daniel Kroening Date: Fri, 8 Nov 2019 13:10:12 +0000 Subject: [PATCH] cpp_static_assertt constructor now has operands This avoids a deprecated constructor for binary_exprt. --- src/cpp/cpp_static_assert.h | 7 ++++++- src/cpp/parse.cpp | 17 +++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/cpp/cpp_static_assert.h b/src/cpp/cpp_static_assert.h index 7641549a37c..1802002d527 100644 --- a/src/cpp/cpp_static_assert.h +++ b/src/cpp/cpp_static_assert.h @@ -17,7 +17,12 @@ Author: Daniel Kroening, kroening@cs.cmu.edu class cpp_static_assertt : public binary_exprt { public: - cpp_static_assertt() : binary_exprt(ID_cpp_static_assert) + cpp_static_assertt(exprt _cond, exprt _description) + : binary_exprt( + std::move(_cond), + ID_cpp_static_assert, + std::move(_description), + typet()) { } diff --git a/src/cpp/parse.cpp b/src/cpp/parse.cpp index b869257466d..28dae749e5a 100644 --- a/src/cpp/parse.cpp +++ b/src/cpp/parse.cpp @@ -920,19 +920,20 @@ bool Parser::rStaticAssert(cpp_static_assertt &cpp_static_assert) if(lex.get_token(tk)!=TOK_STATIC_ASSERT) return false; - cpp_static_assert=cpp_static_assertt(); - set_location(cpp_static_assert, tk); - if(lex.get_token(tk)!='(') return false; - if(!rExpression(cpp_static_assert.cond(), false)) + exprt cond; + + if(!rExpression(cond, false)) return false; if(lex.get_token(tk)!=',') return false; - if(!rExpression(cpp_static_assert.description(), false)) + exprt description; + + if(!rExpression(description, false)) return false; if(lex.get_token(tk)!=')') @@ -941,6 +942,10 @@ bool Parser::rStaticAssert(cpp_static_assertt &cpp_static_assert) if(lex.get_token(tk)!=';') return false; + cpp_static_assert = + cpp_static_assertt(std::move(cond), std::move(description)); + set_location(cpp_static_assert, tk); + return true; } @@ -7505,7 +7510,7 @@ optionalt Parser::rStatement() case TOK_STATIC_ASSERT: { - cpp_static_assertt cpp_static_assert; + cpp_static_assertt cpp_static_assert{nil_exprt(), nil_exprt()}; if(!rStaticAssert(cpp_static_assert)) return {};