C++ auto type deduction fails under certain circumstances

Hello,

I would like to report a compiler bug (I think):
auto type deduction fails with the current version of PGI compiler when a variable name is an existing type name.

More information here: https://github.com/pybind/pybind11/issues/1381

Thank you.

Hi Bekos,

Thanks for the report. I tested the minimal reproducer as shown in “chuckatkins” comment and was able to reproduce the error with PGI 18.4. The good news is that it looks like we will have this fixed in our up coming 18.7 release (with 18.10 being the next community edition where the fix will be available).

Best Regards,
Mat

% cat test.cpp
class a { };

namespace foo {
namespace bar {
class b { };
void baz(a *arg) {
    auto b = reinterpret_cast<bar::b*>(arg);
}
}
}
% pgc++ -std=c++11 -w -c test.cpp -V18.4
"test.cpp", line 7: error: expected an identifier
      auto b = reinterpret_cast<bar::b*>(arg);
             ^

"test.cpp", line 7: error: no suitable constructor exists to convert from
          "foo::bar::b *" to "foo::bar::b"
      auto b = reinterpret_cast<bar::b*>(arg);
               ^

2 errors detected in the compilation of "test.cpp".
% pgc++ -std=c++11 -w -c test.cpp -V18.7
%