[Boost-bugs] [Boost C++ Libraries] #1828: is_class maybe triggering a VC8 compiler bug

Subject: [Boost-bugs] [Boost C++ Libraries] #1828: is_class maybe triggering a VC8 compiler bug
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-15 07:46:37


#1828: is_class maybe triggering a VC8 compiler bug
--------------------------+-------------------------------------------------
 Reporter: Stefan | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: type_traits
  Version: Boost 1.34.1 | Severity: Problem
 Keywords: |
--------------------------+-------------------------------------------------
 The following code compiles with an error. However there shouldn't be an
 error. Basically, the line in main() fails to compile because the compiler
 thinks sizeof(&Der::foo) is 16, which just can't be so. This case is very
 intricate, and any modifications to the code compile cleanly. For example,
 if instead of is_class, we use is_void, the code compiles; if hasher is
 not partially specialized for pointers, it compiles; if 'base' doesn't use
 CRTP, it compiles; if hasher<T> isn't a member variable, it compiles; if
 hasher is parametrized by T* or something else, it compiles.

  #include <boost/type_traits/is_class.hpp>
  template <class T> struct hasher {};
  template <class T> struct hasher<T*>
         : boost::is_class<T>
  {};
  template <class T>
  struct hash_set
  {
         hasher<T> hash;
  };
  template <class D>
  struct base
  {
         hash_set<D*> set;
  };
  struct Der
         : public base<Der>
  {
         void foo();
  };
  int main()
  {
         char x[sizeof(&Der::foo) == 16 ? -1 : 1];
  }

 I don't think this is a boost bug - the failing conditions look too much
 like a compiler-specific bug. Also, this code compiles cleanly on gcc
 3.4.2

 I'd like to hear your opinion, and forward the bug to Microsoft if it's
 really their bug.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1828>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC