Skip to content

Commit 56652be

Browse files
committed
BROKEN: {} constructor rules
1 parent eb25a0a commit 56652be

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/cpp/parse.cpp

+30-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Author: Daniel Kroening, [email protected]
2323
#include "cpp_member_spec.h"
2424
#include "cpp_enum_type.h"
2525

26+
#define DEBUG
2627
#ifdef DEBUG
2728
#include <iostream>
2829

@@ -6381,7 +6382,6 @@ bool Parser::rPostfixExpr(exprt &exp)
63816382
std::cout << std::string(__indent, ' ') << "Parser::rPostfixExpr 3\n";
63826383
#endif
63836384

6384-
lex.get_token(op);
63856385
if(!rFunctionArguments(e))
63866386
return false;
63876387

@@ -6405,6 +6405,35 @@ bool Parser::rPostfixExpr(exprt &exp)
64056405
}
64066406
break;
64076407

6408+
case '{':
6409+
#ifdef DEBUG
6410+
std::cout << std::string(__indent, ' ') << "Parser::rPostfixExpr 3a\n";
6411+
#endif
6412+
6413+
// this is a C++11 extension
6414+
if(!rInitializeExpr(e))
6415+
return false;
6416+
6417+
if(lex.get_token(cp)!='}')
6418+
return false;
6419+
6420+
#ifdef DEBUG
6421+
std::cout << std::string(__indent, ' ') << "Parser::rPostfixExpr 4a\n";
6422+
#endif
6423+
6424+
{
6425+
side_effect_expr_function_callt fc(
6426+
std::move(exp), {}, typet{}, source_locationt{});
6427+
fc.arguments().reserve(e.operands().size());
6428+
set_location(fc, op);
6429+
6430+
Forall_operands(it, e)
6431+
fc.arguments().push_back(*it);
6432+
e.operands().clear(); // save some
6433+
exp.swap(fc);
6434+
}
6435+
break;
6436+
64086437
case TOK_INCR:
64096438
lex.get_token(op);
64106439

0 commit comments

Comments
 (0)