Skip to content

Commit fb39c14

Browse files
sloedeskystrife
authored andcommitted
Fix compilation issues for PGI compiler (#81)
* Avoid shadowing issues with class "value" (PGI compiler only) * Add workaround for PGI compiler
1 parent b0f1b58 commit fb39c14

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

include/cpptoml.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,12 @@ class parser
19621962

19631963
if (curr_table->contains(part))
19641964
{
1965+
#if !defined(__PGI)
19651966
auto b = curr_table->get(part);
1967+
#else
1968+
// Workaround for PGI compiler
1969+
std::shared_ptr<base> b = curr_table->get(part);
1970+
#endif
19661971
if (b->is_table())
19671972
curr_table = static_cast<table*>(b.get());
19681973
else if (b->is_table_array())
@@ -2044,7 +2049,12 @@ class parser
20442049

20452050
if (curr_table->contains(part))
20462051
{
2052+
#if !defined(__PGI)
20472053
auto b = curr_table->get(part);
2054+
#else
2055+
// Workaround for PGI compiler
2056+
std::shared_ptr<base> b = curr_table->get(part);
2057+
#endif
20482058

20492059
// if this is the end of the table array name, add an
20502060
// element to the table array that we just looked up,
@@ -3030,9 +3040,9 @@ class parser
30303040
auto arr = make_array();
30313041
while (it != end && *it != ']')
30323042
{
3033-
auto value = parse_value(it, end);
3034-
if (auto v = value->as<Value>())
3035-
arr->get().push_back(value);
3043+
auto val = parse_value(it, end);
3044+
if (auto v = val->as<Value>())
3045+
arr->get().push_back(val);
30363046
else
30373047
throw_parse_exception("Arrays must be homogeneous");
30383048
skip_whitespace_and_comments(it, end);

0 commit comments

Comments
 (0)