Skip to content

Commit 6533f45

Browse files
author
Daniel Kroening
committed
cpp_static_assertt constructor now has operands
This avoids a deprecated constructor for binary_exprt.
1 parent ee79ae2 commit 6533f45

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/cpp/cpp_static_assert.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ Author: Daniel Kroening, [email protected]
1717
class cpp_static_assertt : public binary_exprt
1818
{
1919
public:
20-
cpp_static_assertt() : binary_exprt(ID_cpp_static_assert)
20+
cpp_static_assertt(exprt _cond, exprt _description)
21+
: binary_exprt(
22+
std::move(_cond),
23+
ID_cpp_static_assert,
24+
std::move(_description),
25+
typet())
2126
{
2227
}
2328

src/cpp/parse.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -920,19 +920,20 @@ bool Parser::rStaticAssert(cpp_static_assertt &cpp_static_assert)
920920
if(lex.get_token(tk)!=TOK_STATIC_ASSERT)
921921
return false;
922922

923-
cpp_static_assert=cpp_static_assertt();
924-
set_location(cpp_static_assert, tk);
925-
926923
if(lex.get_token(tk)!='(')
927924
return false;
928925

929-
if(!rExpression(cpp_static_assert.cond(), false))
926+
exprt cond;
927+
928+
if(!rExpression(cond, false))
930929
return false;
931930

932931
if(lex.get_token(tk)!=',')
933932
return false;
934933

935-
if(!rExpression(cpp_static_assert.description(), false))
934+
exprt description;
935+
936+
if(!rExpression(description, false))
936937
return false;
937938

938939
if(lex.get_token(tk)!=')')
@@ -941,6 +942,10 @@ bool Parser::rStaticAssert(cpp_static_assertt &cpp_static_assert)
941942
if(lex.get_token(tk)!=';')
942943
return false;
943944

945+
cpp_static_assert =
946+
cpp_static_assertt(std::move(cond), std::move(description));
947+
set_location(cpp_static_assert, tk);
948+
944949
return true;
945950
}
946951

@@ -7505,7 +7510,7 @@ optionalt<codet> Parser::rStatement()
75057510

75067511
case TOK_STATIC_ASSERT:
75077512
{
7508-
cpp_static_assertt cpp_static_assert;
7513+
cpp_static_assertt cpp_static_assert{nil_exprt(), nil_exprt()};
75097514

75107515
if(!rStaticAssert(cpp_static_assert))
75117516
return {};

0 commit comments

Comments
 (0)