pgc++ V16.10 compiler error std::map::emplace

The PGI C++ Compiler (Community Edition, V16.10) cannot compile the following C++11 program:

#include <map>
#include <tuple>
#include <string>
#include <iostream>

// This is the value of the map
struct Val {
    int i;
    double d;
    
    Val(int ii, double dd): i{ii}, d{dd} {}
};

int main(int argc, char *argv[]) {
    std::map<std::string, Val> m;
    m.emplace(
        std::piecewise_construct,
        std::forward_as_tuple("foo"),
        std::forward_as_tuple(42, 3.14)
    );
    for (const auto& it : m) {
        std::cout << "m[" << it.first << "]=(" 
        << it.second.i << "," << it.second.d << ")" << std::endl;
    }
}

The compiler was invoked in C++11 mode as:

pgc++ --c++11 pgi_mapemplace.c -o pemp

The error messages are:

“pgi_mapemplace.cc”, line 19: error: class “std::__1::map<std::__1::string,
Val, std::__1::lessstd::__1::string,
std::__1::allocator<std::__1::pair<const std::__1::string, Val>>>”
has no member “emplace”
m.emplace(
^

“pgi_mapemplace.cc”, line 21: error: namespace “std” has no member
“forward_as_tuple”
std::forward_as_tuple(“foo”),
^

“pgi_mapemplace.cc”, line 22: error: namespace “std” has no member
“forward_as_tuple”
std::forward_as_tuple(42, 3.14)
^

Clang++ on the Mac (Version 7.3) compiles this program without any errors, and the executable provides the expected output.

This I consider a serious bug. I am wondering whether a fix is available. I am also wondering whether the same bug can be found in the “for-fee” version of pg++ (which I do not have).

Thanks, Laryx

Assuming the g++ compilers are 5.3 or newer, this should be working in
the 17.4 Community Edition, coming this month.

dave

Unfortunately the 17.4 Community Edition (on the Mac, macOS=10.11.6, XCode=7.3) still has the same bug. :-(

I can confirm, however, that the bug is indeed gone under Linux (Ubuntu 16.04 LTS, gcc/g++ = 5.4.0).

Obviously I checked only the Linux version when I originally replied,
and I have determined that the OS X version still has problems.
That was a mistake, because I thought they had fixed an issue that
made Linux now work. Your example points out other header issues.

I have filed TPR 24353 to address.

dave