// { dg-do run }
|
// { dg-do run }
|
// Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
// Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
// Contributed by Nathan Sidwell 21 Nov 1999
|
// Contributed by Nathan Sidwell 21 Nov 1999
|
|
|
// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in member functions
|
// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in member functions
|
|
|
#include
|
#include
|
#include
|
#include
|
|
|
static bool bad = false;
|
static bool bad = false;
|
|
|
struct X
|
struct X
|
{
|
{
|
X ();
|
X ();
|
~X ();
|
~X ();
|
void fn ();
|
void fn ();
|
operator int ();
|
operator int ();
|
};
|
};
|
|
|
X::X ()
|
X::X ()
|
{
|
{
|
char const *function = __FUNCTION__;
|
char const *function = __FUNCTION__;
|
char const *pretty = __PRETTY_FUNCTION__;
|
char const *pretty = __PRETTY_FUNCTION__;
|
|
|
printf ("ctor\n");
|
printf ("ctor\n");
|
printf ("__FUNCTION__ %s\n", function);
|
printf ("__FUNCTION__ %s\n", function);
|
printf ("__PRETTY_FUNCTION__ %s\n", pretty);
|
printf ("__PRETTY_FUNCTION__ %s\n", pretty);
|
|
|
if (strcmp (function, "X"))
|
if (strcmp (function, "X"))
|
bad = true;
|
bad = true;
|
if (strcmp (pretty, "X::X()"))
|
if (strcmp (pretty, "X::X()"))
|
bad = true;
|
bad = true;
|
}
|
}
|
X::~X ()
|
X::~X ()
|
{
|
{
|
char const *function = __FUNCTION__;
|
char const *function = __FUNCTION__;
|
char const *pretty = __PRETTY_FUNCTION__;
|
char const *pretty = __PRETTY_FUNCTION__;
|
|
|
printf ("dtor\n");
|
printf ("dtor\n");
|
printf ("__FUNCTION__ %s\n", function);
|
printf ("__FUNCTION__ %s\n", function);
|
printf ("__PRETTY_FUNCTION__ %s\n", pretty);
|
printf ("__PRETTY_FUNCTION__ %s\n", pretty);
|
|
|
if (strcmp (function, "~X"))
|
if (strcmp (function, "~X"))
|
bad = true;
|
bad = true;
|
if (strcmp (pretty, "X::~X()"))
|
if (strcmp (pretty, "X::~X()"))
|
bad = true;
|
bad = true;
|
}
|
}
|
void X::fn ()
|
void X::fn ()
|
{
|
{
|
char const *function = __FUNCTION__;
|
char const *function = __FUNCTION__;
|
char const *pretty = __PRETTY_FUNCTION__;
|
char const *pretty = __PRETTY_FUNCTION__;
|
|
|
printf ("member fn\n");
|
printf ("member fn\n");
|
printf ("__FUNCTION__ %s\n", function);
|
printf ("__FUNCTION__ %s\n", function);
|
printf ("__PRETTY_FUNCTION__ %s\n", pretty);
|
printf ("__PRETTY_FUNCTION__ %s\n", pretty);
|
|
|
if (strcmp (function, "fn"))
|
if (strcmp (function, "fn"))
|
bad = true;
|
bad = true;
|
if (strcmp (pretty, "void X::fn()"))
|
if (strcmp (pretty, "void X::fn()"))
|
bad = true;
|
bad = true;
|
}
|
}
|
X::operator int ()
|
X::operator int ()
|
{
|
{
|
char const *function = __FUNCTION__;
|
char const *function = __FUNCTION__;
|
char const *pretty = __PRETTY_FUNCTION__;
|
char const *pretty = __PRETTY_FUNCTION__;
|
|
|
printf ("conversion\n");
|
printf ("conversion\n");
|
printf ("__FUNCTION__ %s\n", function);
|
printf ("__FUNCTION__ %s\n", function);
|
printf ("__PRETTY_FUNCTION__ %s\n", pretty);
|
printf ("__PRETTY_FUNCTION__ %s\n", pretty);
|
|
|
if (strcmp (pretty, "X::operator int()"))
|
if (strcmp (pretty, "X::operator int()"))
|
bad = true;
|
bad = true;
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int main ()
|
int main ()
|
{
|
{
|
{
|
{
|
X x;
|
X x;
|
|
|
x.fn ();
|
x.fn ();
|
(void)int (x);
|
(void)int (x);
|
}
|
}
|
return bad;
|
return bad;
|
}
|
}
|
|
|