Skip to content

Commit 549d1f9

Browse files
committed
BROKEN: {} constructor rules
1 parent d25d041 commit 549d1f9

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

@@ -6423,7 +6424,6 @@ bool Parser::rPostfixExpr(exprt &exp)
64236424
std::cout << std::string(__indent, ' ') << "Parser::rPostfixExpr 3\n";
64246425
#endif
64256426

6426-
lex.get_token(op);
64276427
if(!rFunctionArguments(e))
64286428
return false;
64296429

@@ -6447,6 +6447,35 @@ bool Parser::rPostfixExpr(exprt &exp)
64476447
}
64486448
break;
64496449

6450+
case '{':
6451+
#ifdef DEBUG
6452+
std::cout << std::string(__indent, ' ') << "Parser::rPostfixExpr 3a\n";
6453+
#endif
6454+
6455+
// this is a C++11 extension
6456+
if(!rInitializeExpr(e))
6457+
return false;
6458+
6459+
if(lex.get_token(cp)!='}')
6460+
return false;
6461+
6462+
#ifdef DEBUG
6463+
std::cout << std::string(__indent, ' ') << "Parser::rPostfixExpr 4a\n";
6464+
#endif
6465+
6466+
{
6467+
side_effect_expr_function_callt fc(
6468+
std::move(exp), {}, typet{}, source_locationt{});
6469+
fc.arguments().reserve(e.operands().size());
6470+
set_location(fc, op);
6471+
6472+
Forall_operands(it, e)
6473+
fc.arguments().push_back(*it);
6474+
e.operands().clear(); // save some
6475+
exp.swap(fc);
6476+
}
6477+
break;
6478+
64506479
case TOK_INCR:
64516480
lex.get_token(op);
64526481

0 commit comments

Comments
 (0)