incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <mse...@gmail.com>
Subject Re: [HP aCC 3.xx on HP-UX/PA-RISC] 20.specialized test fails to compile
Date Tue, 14 Oct 2008 02:38:34 GMT
Farid Zaripov wrote:
>   The 20.specialized test fails to compile after change in http://svn.apache.org/viewvc?view=rev&revision=697885
> 
> --------
> aCC -c  -D_RWSTDDEBUG   -mt -I$(TOPDIR)/include -I$(BUILDDIR)/include -I$(TOPDIR)/tests/include
 -AA  -g +d  +DD64 +w +W392,655,684,818,819,849   $(TOPDIR)/tests/utilities/20.specialized.cpp
> Error 746: "$(TOPDIR)/include/rw/_specialized.h", line 175 # Cannot use static_cast to
convert struct FwdIter<Y> to volatile void *.
>                     _RWSTD_STATIC_CAST (volatile void*, &*__res);
>                     ^^^^^^^^^^^^^^^^^^
> Error 556: "$(TOPDIR)/tests/utilities/20.specialized.cpp", line 140 # Unable to generate
specialization "FwdIter<Y> std::uninitialized_copy<InputIter<int>,FwdIter<Y>
>(InputIter<int>,InputIter<int>,FwdIter<Y>)" due to errors during generation.
>                 std::uninitialized_copy (first, last, result);
>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Error 556: "$(TOPDIR)/tests/utilities/20.specialized.cpp", line 140 # Unable to generate
specialization "FwdIter<Y> std::uninitialized_copy<InputIter<int>,FwdIter<Y>
>(InputIter<int>,InputIter<int>,FwdIter<Y>)" due to errors during generation.
>                 std::uninitialized_copy (first, last, result);
>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> gmake: *** [20.specialized.o] Error 2
> --------
> 
>   On the other compilers/platforms this test compiled without errors.
> 
>   Can anyone to look into this issue?

It's the const qualifier on __ptr that's causing the trouble (see
the test case below). This patch fixes for me:

Index: include/rw/_specialized.h
===================================================================
--- include/rw/_specialized.h   (revision 704292)
+++ include/rw/_specialized.h   (working copy)
@@ -171,7 +171,8 @@

      _TRY {
          for (; __first != __last; ++__first, ++__res) {
-            volatile void* const __ptr =
+            // avoid const-qualifying ptr to prevent an HP aCC 3 bug
+            volatile void* /* const */ __ptr =
                  _RWSTD_STATIC_CAST (volatile void*, &*__res);
              ::new (_RWSTD_CONST_CAST (void*, __ptr)) _TypeT (*__first);
          }

I haven't tested it except with aCC but it seems safe enough
to commit if you're happy with it. What a pain this bug, huh?

Martin


$ cat z.cpp && aCC -V z.cpp
struct S {
     int *x;
     int& operator* () const { return *x; }
};

template <class T> void foo (T x) {
     volatile void* const p = static_cast<volatile void*>(&*x);
}

int main () {
     foo (S ());
}
aCC: HP ANSI C++ B3910B A.03.73
Error 746: "z.cpp", line 7 # Cannot use static_cast to convert struct S 
to volatile void *.
         volatile void* const p = static_cast<volatile void*>(&*x);
                                                              ^
Error 556: "z.cpp", line 11 # Unable to generate specialization "void 
foo<S>(S)" due to errors during generation.
         foo (S ());
         ^^^^^^^^^^
Error 556: "z.cpp", line 11 # Unable to generate specialization "void 
foo<S>(S)" due to errors during generation.
         foo (S ());
         ^^^^^^^^^^


Mime
View raw message