[FX-596] f8c generates invalid C++ code - Fix8 JIRA

f8c generates invalid C++ code

Description

Hi, I'm using version 1.3.4 cloned from fix8's repository master branch. I generated FIX 5.0 SP2 files using command

1 ./compiler/f8c -V -p app -f -S -e -o fix8 -c client -t 4 ./schema/FIX50SP2.xml

and I'm compiling using command

1 g++ -Wall -std=c++11 -o app -I ../fix8/include main.cpp

. I have an empty main(), just included necessary headers.

The problem is that generated file fix_classes.hxx contains syntax error in classes `header` and `trailer`. Compiler generates fragment:

1 2 3 explicit trailer(bool deepctor=true), _check_sum(new check_sum()) { add_preamble(); } ~trailer() = default;

Why is `new` in the function declaration (error: expected identifier before ‘new’)? Also there is an error in declaration (error: only declarations of constructors and conversion operators can be ‘explicit’). I found that this code is generated in f8c.cpp line 1125:

1 2 3 4 if (isHeader) osc_hpp << "_begin_string(new begin_string(ctx()._beginStr)), _body_length(new body_length()), _msg_type(new msg_type())"; else osc_hpp << "_check_sum(new check_sum())";

I'll happily provide more information on request, just tell me what is necessary.

Environment

Linux Ubuntu 15.10, g++ 5.2.1

Status

Assignee

David Dight

Reporter

Tomasz Kowalczyk

Labels

Branch

master

Products

Open Source

Components

Fix versions

Affects versions

1.3.4

Priority

Pending