OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.dg/] [expr/] [sizeof2.C] - Rev 12

Compare with Previous | Blame | View Log

// { dg-do compile }
// Contributed by Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
// PR c++/9259: Allow non-qualified member calls in sizeof expressions.

template <bool> struct StaticAssert;
template <> struct StaticAssert<true> {};

struct S 
{
  static int check ();
  static double check2 ();
  static const int value = sizeof(check());
  static const int value2 = sizeof(check2());
};

template <class>
struct T
{
  static int check ();
  static double check2 ();
  static const int value = sizeof(check());
  static const int value2 = sizeof(check2());
};

StaticAssert<(S::value == sizeof(int))> s;
StaticAssert<(S::value2 == sizeof(double))> s2;

StaticAssert<(T<void>::value == sizeof(int))> t;
StaticAssert<(T<void>::value2 == sizeof(double))> t2;

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.