5 Replies Latest reply: Apr 13, 2014 9:45 AM by Steve.Clamage-Oracle RSS

    compile error in bitset when using 12.4 beta with -std=c++11

    mrjones69

      When using the new -std=c++11 option, there is a compile error in SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset.

      On line 86, there is a cpp conditional that is using the sizeof() operator.

      Can you use an operator like that in a preprocessor conditional?

      I grepped the other files in that directory and this seems to be the only instance of this usage.

       

      You can easily reproduce this by compiling a trivial program.

       

      foo.c:

      #include <bitset>

      int main( void ) { return 0; }

       

      CC -std=c++11 foo.c

       

      "/export/home/SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset'", line 86: Error: Badly formed constant expression.

      "/export/home/SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset", line 89: Error: "}" expected instead of "{".

      "/export/home/SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset", line 238: Error: _M_do_left_shift is not a member of std::_Base_bitset<_Nw>.

      "/export/home/SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset", line 264: Error: _M_do_right_shift is not a member of std::_Base_bitset<_Nw>.

      "/export/home/SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset", line 291: Error: _M_do_to_ulong is not a member of std::_Base_bitset<_Nw>.

      "/export/home/SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset", line 302: Error: _M_do_to_ullong is not a member of std::_Base_bitset<_Nw>.

      "/export/home/SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset", line 319: Error: _M_do_find_first is not a member of std::_Base_bitset<_Nw>.

      "/export/home/SolarisStudio12.4-beta_mar14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.7.2/bitset", line 335: Error: _M_do_find_next is not a member of std::_Base_bitset<_Nw>.

       

      I didn't look into lines 238+ yet. Figured that was likely a side-effect from the earlier problem once the parsing got off-track.

        • 1. Re: compile error in bitset when using 12.4 beta with -std=c++11
          Sfv-Oracle

          As mentioned in our "whats' new" document, C++11 support in 12.4 Beta is somewhat limited.

          In particular we do not have a full support of C++11 Initializer Lists yet.

          And that (particular initializer lists syntax parsing) is what fails in <bitset>.

           

          Said that, among the standard C++11 headers our 12.4 Beta does not support:

            <complex>

            <bitset> , <regex> (includes <bitset>)

            <chrono>

            <condition_variable>

            <atomic> / <future> / <mutex>

           

          We do not target full support for concurrency-related C++11 functionality with 12.4 release, so the latter

          set of headers might continue to have problems.

           

          Everything else is going to be addressed in a final 12.4 release.

           

          regards,

          __Fedor.

          • 2. Re: compile error in bitset when using 12.4 beta with -std=c++11
            marc1842fr

            SFV wrote:

             

            As mentioned in our "whats' new" document, C++11 support in 12.4 Beta is somewhat limited.

            In particular we do not have a full support of C++11 Initializer Lists yet.

            And that (particular initializer lists syntax parsing) is what fails in <bitset>.

             

            I assume it is a related issue that makes this code fail to compile?

             

            struct A { } ;

             

            struct B
            {
            A m = { } ;
            B ( ) { }
            } ;

             

            (note that the compiler crashes if I remove the definition of A)

            On this non-supported platform, it means <memory> can't be included either.

            • 3. Re: compile error in bitset when using 12.4 beta with -std=c++11
              Sfv-Oracle

              > it is a related issue that makes this code fail to compile?

               

              Yep, we do not handle in-class data-member initializers with initializer-list syntax yet.

               

              > it means <memory> can't be included either.

              There should be no problem with <memory> related to this issue and I dont see how it could change with non-supported platform

              (as we bring those headers with the compiler).

              So if it does not work for you then it is something new and it would be nice to know details.

               

              regards,

              __Fedor.

              • 4. Re: compile error in bitset when using 12.4 beta with -std=c++11
                marc1842fr

                SFV wrote:

                 

                > it means <memory> can't be included either.

                There should be no problem with <memory> related to this issue and I dont see how it could change with non-supported platform

                (as we bring those headers with the compiler).

                So if it does not work for you then it is something new and it would be nice to know details.

                stedding /tmp $ cat mem.cc
                #include <memory>
                stedding /tmp $ sunCC mem.cc -c -std=c++11
                "/opt/SolarisStudio12.4-beta_mar14-linux-x86/lib/compilers/CC-gcc/include/c++/4.7.2/ext/concurrence.h", line 202: Error: Cannot assign ? to pthread_mutex_t.
                "/opt/SolarisStudio12.4-beta_mar14-linux-x86/lib/compilers/CC-gcc/include/c++/4.7.2/ext/concurrence.h", line 202: Error: Cannot assign ? to pthread_mutex_t.
                2 Error(s) detected.

                 

                The problematic line is:

                    __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;

                • 5. Re: compile error in bitset when using 12.4 beta with -std=c++11
                  Steve.Clamage-Oracle

                  Yes, we have a known problem with header <memory> on Oracle Linux, bug 18545714. I get the same error messages you show. (There is no problem on Solaris.)

                  We expect to have this problem resolved for the final release.


                  For future reference, including the platform (Solaris/Linux, OS version, Sparc/x86) and compilation mode (-m32/-m64, -compat=x/-std=x, -library=x) in the bug report can save time.