https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98360

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC, ICC and MSVC all agree that this is valid code and all produce 4.
clang is the only one which rejects it.

Here is an even more reduced testcase:
template <typename T>
struct uintset
{
  T values[1];
  struct traits  {  };
  struct hash : traits
  {
    int foo () {
      return sizeof (uintset::values);
    }
  };
  hash h;
};
uintset<int> s;
int x = s.h.foo ();

If you remove the base class or change it not to dependent type, the code is
accepted. 

The defect reports in this area:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#613
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#198

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html is the paper
which resolves 613.


I suspect GCC is correct if I go by this paper.

Reply via email to