Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-1001

[XLC 9.0] Partial specialization on unbound array fails due to ambiguity

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • External
    • None
    • Incorrect Behavior

    Description

      $ cat t.cpp && xlC t.cpp
      
      template <class T>
      struct is_unbound_array
      {
          enum { value = 0 };
      };
      
      template <class T, unsigned N>
      struct is_unbound_array<T [N]>
      {
          enum { value = 0 };
      };
      
      template <class T>
      struct is_unbound_array<T []>
      {
          enum { value = 1 };
      };
      
      extern "C" int printf (const char*, ...);
      
      int main ()
      {
      #define test(X) printf ("%s = %u\n", #X, X)
      
          test ((is_unbound_array<int>::value));
          test ((is_unbound_array<int []>::value));
          test ((is_unbound_array<int [2]>::value));
          test ((is_unbound_array<int [][2][3][4]>::value));
          test ((is_unbound_array<int [2][3][4]>::value));
      
          return 0;
      }
      "t.cpp", line 15.8: 1540-0403 (S) "template <class T> struct is_unbound_array<T []>" is already defined.
      "t.cpp", line 9.8: 1540-0425 (I) "is_unbound_array<T [N]>" is defined on line 9 of "t.cpp".
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            vitek Travis Vitek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: