nvcc and nested class issue

Hi, I’ve run into an issue which appears to suggest that nvcc is not treating nested C++ classes correctly, and would be grateful for any help with the issue. The problem comes from a header file from the jsoncpp package, the file being json/value.h. The error is:

---
/usr/include/jsoncpp/json/value.h: At global scope:
/usr/include/jsoncpp/json/value.h:164:16: error: ‘class Json::Value::CZString’ is private
       class CZString
                ^
/usr/include/jsoncpp/json/value.h:998:49: error: within this context
       explicit ValueConstIterator( const Value::ObjectValues::iterator &current );
---

That file has a class declaration of (unnecessary detail redacted):

class JSON_API Value
   {
      public:
        typedef ValueConstIterator const_iterator;
        ...
      private:
        class CZString
        {
           ...
         };
     };

By changing that “private” declaration to “public” I can make the error message go away, but I shouldn’t have to as there’s nothing wrong with that code. g++ (v 4.8) has no problem with it, and I’m not keen on changing that access level just to placate nvcc, especially as it’s a system header file. I’m using CUDA 7.5 with C++11 extensions under Ubuntu 14.04.3. Any help would be much appreciated.

Can also confirm this issue (and that changing the access level solves it); since this compiles fine on GCC I’m assuming it’s an error on nvcc somehow.

I am not enough of a C++ language lawyer to know what the correct behavior is here, but would like to point out that gcc is not the final arbiter of C++ correctness, the ISO C++ 2011 standard is. gcc supports code idioms beyond the standard (basically, proprietary extensions). gcc also contains bugs like any other tool chain.

If, after consultation of the standard, you believe the CUDA compiler is in error here, I would suggest filing a bug report with NVIDIA via the reporting form linked from the CUDA register developer website (start at https://developer.nvidia.com/).