| 1 |
// { dg-do assemble } |
| 2 |
// { dg-options "-Wreturn-type" } |
| 3 |
// GROUPS passed error-reporting |
| 4 |
|
| 5 |
// DR 295 allows qualification via typedef |
| 6 |
|
| 7 |
template <char C> |
| 8 |
class badoo |
| 9 |
{ |
| 10 |
}; |
| 11 |
|
| 12 |
template <int (*F) (int)> |
| 13 |
class doowop |
| 14 |
{ |
| 15 |
}; |
| 16 |
|
| 17 |
struct A |
| 18 |
{ |
| 19 |
int a; |
| 20 |
~A () { a = 0; } |
| 21 |
operator int () { return a; } |
| 22 |
}; |
| 23 |
|
| 24 |
extern "C" int atoi (const char *); |
| 25 |
|
| 26 |
int (*fee)(const char *) = atoi; |
| 27 |
int (**bar)(const char *) = &fee; |
| 28 |
|
| 29 |
const char* s = "4"; |
| 30 |
const char** sp = &s; |
| 31 |
const char*** spp = &sp; |
| 32 |
|
| 33 |
int foo (int a = (**bar) (s)) |
| 34 |
{ |
| 35 |
return doowop<foo>::bar; // { dg-error "" } not a member |
| 36 |
} |
| 37 |
|
| 38 |
int foo2 (int (*a)(int) = &foo) |
| 39 |
{ |
| 40 |
undef4 (1); // { dg-error "4:'undef4' was not declared" } implicit declaration |
| 41 |
return 1; |
| 42 |
} |
| 43 |
|
| 44 |
class X{ |
| 45 |
class Y{}; // { dg-message "" } private |
| 46 |
}; |
| 47 |
|
| 48 |
typedef int const * bart (); |
| 49 |
//The following is DR295 dependant |
| 50 |
typedef bart const * const * bar2; |
| 51 |
typedef bart volatile * const * bar2v; |
| 52 |
|
| 53 |
bar2 baz (X::Y y) // { dg-error "" } in this context |
| 54 |
{ |
| 55 |
X::Y f; // { dg-error "" } in this context |
| 56 |
bar2 wa [5]; |
| 57 |
wa[0] = baz(f); |
| 58 |
undef2 (1); // { dg-error "3:'undef2' was not declared" } implicit declaration |
| 59 |
} // { dg-warning "no return statement" } |
| 60 |
|
| 61 |
int ninny () |
| 62 |
{ |
| 63 |
struct A |
| 64 |
{ |
| 65 |
static int ninny2 () { return badoo<'\001'>::foo; } // { dg-error "" } not a member |
| 66 |
}; |
| 67 |
|
| 68 |
return A::ninny2(); |
| 69 |
} |
| 70 |
|
| 71 |
int darg (char X::*p) |
| 72 |
{ |
| 73 |
undef3 (1); // { dg-error "4:'undef3' was not declared" } implicit declaration |
| 74 |
} // { dg-warning "no return statement" } |