1 Reply Latest reply: Jul 30, 2014 12:20 PM by Steve.Clamage-Oracle RSS

    Sorting a vector of pairs in Solaris Studio 12.4 beta July refresh

    1059891

      The following C++ program doesn't compile in C++11 mode with the Solaris Studio 12.4 beta July refresh compiler:

       

      #include <algorithm>

      #include <string>

      #include <utility>

      #include <vector>

       

      int main(int, char **)

      {

          std::vector<std::pair<int, std::string>> vec;

       

          vec.emplace_back(1, "a");

          vec.emplace_back(3, "c");

          vec.emplace_back(2, "b");

       

          std::sort(vec.begin(), vec.end());

       

          return 0;

      }

       

      Compiling with:

       

      % CC -std=c++11 Main.cc

       

      results in:

       

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/include/CC/gnu/bits/stl_pair.h", line 263: Error: The name __x is unusable in std::iter_swap<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>).

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 88:     Where: While instantiating "std::iter_swap<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>)".

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 88:     Where: Instantiated from std::__move_median_to_first<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>).

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 2282:     Where: Instantiated from std::__introsort_loop<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, int>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, int).

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 5452:     Where: Instantiated from non-template code.

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/include/CC/gnu/bits/stl_pair.h", line 263: Error: The name __y is unusable in std::iter_swap<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>).

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 88:     Where: While instantiating "std::iter_swap<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>)".

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 88:     Where: Instantiated from std::__move_median_to_first<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>).

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 2282:     Where: Instantiated from std::__introsort_loop<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, int>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, int).

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 5452:     Where: Instantiated from non-template code.

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 103: Error: A constant expression is required here.

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 88:     Where: While instantiating "std::iter_swap<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>)".

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 88:     Where: Instantiated from std::__move_median_to_first<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>).

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 2282:     Where: Instantiated from std::__introsort_loop<__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, int>(__gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, __gnu_cxx::__normal_iterator<std::pair<int, std::string>*, std::vector<std::pair<int, std::string> >>, int).

      "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_algo.h", line 5452:     Where: Instantiated from non-template code.

      3 Error(s) detected.