incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: Potential eccp-3.9 bug
Date Thu, 10 Jul 2008 21:36:33 GMT
Travis Vitek wrote:
> I'm porting the traits to the EDG compiler, and I'm running into
> failures in the test suite. Here is a simple testcase to illustrate...
> 
>   $ cat t.cpp && eccp t.cpp
>   template <int N>
>   struct S
>   {
>   };
> 
>   const bool a = __has_trivial_constructor( S<1> );
>   "t.cpp", line 6: error: an incomplete class type is not allowed
>     const bool a = __has_trivial_constructor( S<1> );
>                  ^
> 
>   "t.cpp", line 6: warning: variable "a" was declared but never
> referenced
>     const bool a = __has_trivial_constructor( S<1> );
>                ^
> 
>   1 error detected in the compilation of "t.cpp".
> 
> The problem is that the template (S<1> in this case) has not been
> instantiated, and the compiler chokes trying to use the helper because
> the type is not 'complete'. It seems like that is a bug and that
> referring to S<1> here should result in the type being instantiated if
> the compiler requires it.

I agree. I just sent EDG an email with your test case and CC'd
you on it.

> 
> The problem is that many of the trait tests do this type of thing. I can
> work around this pretty easily by explicitly instantating each template
> in each test, but this is tedious (there are many).

I'm not sure I understand why you are even considering working
around it. Doesn't the bug make the built-in traits pretty much
unusable in generic code?

Martin

> 
> I was thinking about doing something like this...
> 
> #define _INSTANTIATE(T)                                       \
>   typedef typename                                            \
>   __rw_conditional<__rw_is_class_or_union<T>::value,          \
>                    T::type,                                   \
>                    void>::type _RWSTD_PASTE(dummy, __LINE__);
> 
> And then sneaking a void typedef into each of my user defined types, and
> then using this macro in the TEST () macro that I use all over the
> tests. Is there a better way?
> 
> Travis


Mime
View raw message