Skip to content

Commit

Permalink
Fix compilation issues for PGI compiler (#81)
Browse files Browse the repository at this point in the history
* Avoid shadowing issues with class "value" (PGI compiler only)
* Add workaround for PGI compiler
  • Loading branch information
sloede authored and skystrife committed Aug 21, 2018
1 parent b0f1b58 commit fb39c14
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions include/cpptoml.h
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,12 @@ class parser

if (curr_table->contains(part))
{
#if !defined(__PGI)
auto b = curr_table->get(part);
#else
// Workaround for PGI compiler
std::shared_ptr<base> b = curr_table->get(part);
#endif
if (b->is_table())
curr_table = static_cast<table*>(b.get());
else if (b->is_table_array())
Expand Down Expand Up @@ -2044,7 +2049,12 @@ class parser

if (curr_table->contains(part))
{
#if !defined(__PGI)
auto b = curr_table->get(part);
#else
// Workaround for PGI compiler
std::shared_ptr<base> b = curr_table->get(part);
#endif

// if this is the end of the table array name, add an
// element to the table array that we just looked up,
Expand Down Expand Up @@ -3030,9 +3040,9 @@ class parser
auto arr = make_array();
while (it != end && *it != ']')
{
auto value = parse_value(it, end);
if (auto v = value->as<Value>())
arr->get().push_back(value);
auto val = parse_value(it, end);
if (auto v = val->as<Value>())
arr->get().push_back(val);
else
throw_parse_exception("Arrays must be homogeneous");
skip_whitespace_and_comments(it, end);
Expand Down

0 comments on commit fb39c14

Please sign in to comment.