stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek" <Travis.Vi...@roguewave.com>
Subject Potential eccp-3.9 bug
Date Thu, 10 Jul 2008 17:41:09 GMT

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.

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 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