mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-28 00:34:41 +08:00
* g++.old-deja/g++.other/cast4.C: New test.
From-SVN: r31237
This commit is contained in:
parent
c0d2229e90
commit
ac8cd718e6
@ -1,3 +1,7 @@
|
||||
2000-01-05 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* g++.old-deja/g++.other/cast4.C: New test.
|
||||
|
||||
Wed Jan 5 00:26:20 2000 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* gcc.c-torture/compile/20000105-2.c: New test.
|
||||
|
63
gcc/testsuite/g++.old-deja/g++.other/cast4.C
Normal file
63
gcc/testsuite/g++.old-deja/g++.other/cast4.C
Normal file
@ -0,0 +1,63 @@
|
||||
// Build don't link:
|
||||
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 3 Jan 2000 <nathan@acm.org>
|
||||
|
||||
// Derived from a bug report by Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
struct A {operator char * () { return 0;} };
|
||||
struct B {operator char * () const { return 0;} };
|
||||
struct C {operator char const * () { return 0;} };
|
||||
struct D {operator char const * () const { return 0;} };
|
||||
|
||||
void f0 ()
|
||||
{
|
||||
A a = A ();
|
||||
B b = B ();
|
||||
C c = C ();
|
||||
D d = D ();
|
||||
|
||||
static_cast <char *> (a);
|
||||
static_cast <char *> (b);
|
||||
static_cast <char *> (c); // ERROR - static cast
|
||||
static_cast <char *> (d); // ERROR - static cast
|
||||
}
|
||||
|
||||
void f1 ()
|
||||
{
|
||||
A a = A ();
|
||||
B b = B ();
|
||||
C c = C ();
|
||||
D d = D ();
|
||||
|
||||
static_cast <const char *> (a);
|
||||
static_cast <const char *> (b);
|
||||
static_cast <const char *> (c);
|
||||
static_cast <const char *> (d);
|
||||
}
|
||||
|
||||
void f2 ()
|
||||
{
|
||||
A const a = A ();
|
||||
B const b = B ();
|
||||
C const c = C ();
|
||||
D const d = D ();
|
||||
|
||||
static_cast <char *> (a); // ERROR - static cast
|
||||
static_cast <char *> (b);
|
||||
static_cast <char *> (c); // ERROR - static cast
|
||||
static_cast <char *> (d); // ERROR - static cast
|
||||
}
|
||||
|
||||
void f3 ()
|
||||
{
|
||||
A const a = A ();
|
||||
B const b = B ();
|
||||
C const c = C ();
|
||||
D const d = D ();
|
||||
|
||||
static_cast <const char *> (a); // ERROR - static cast
|
||||
static_cast <const char *> (b);
|
||||
static_cast <const char *> (c); // ERROR - static cast
|
||||
static_cast <const char *> (d);
|
||||
}
|
Loading…
Reference in New Issue
Block a user