Commit 18eba557 by Giovanni Bajo

re PR c++/9259 (Calling a non-qualified member function within a sizeof()…

re PR c++/9259 (Calling a non-qualified member function within a sizeof() expression leads to "invalid use of undefined type")

	PR c++/9259
	* g++.dg/expr/sizeof2.C: New test.

From-SVN: r75951
parent e9c4897b
2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/9259
* g++.dg/expr/sizeof2.C: New test.
2004-01-15 Kazu Hirata <kazu@cs.umass.edu> 2004-01-15 Kazu Hirata <kazu@cs.umass.edu>
* gcc.dg/sibcall-3.c: Replace mn10?00 with mn10300. * gcc.dg/sibcall-3.c: Replace mn10?00 with mn10300.
......
// { 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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment