OLD | NEW |
1 /* This testcase is part of GDB, the GNU debugger. | 1 /* This testcase is part of GDB, the GNU debugger. |
2 | 2 |
3 Copyright 2008-2012 Free Software Foundation, Inc. | 3 Copyright 2008-2012 Free Software Foundation, Inc. |
4 | 4 |
5 Contributed by Red Hat, originally written by Keith Seitz. | 5 Contributed by Red Hat, originally written by Keith Seitz. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void a_function (void) const // derived::a_function | 301 void a_function (void) const // derived::a_function |
302 { | 302 { |
303 this->base1::a_function (); | 303 this->base1::a_function (); |
304 this->base2::a_function (); | 304 this->base2::a_function (); |
305 } | 305 } |
306 | 306 |
307 protected: | 307 protected: |
308 int foo_; | 308 int foo_; |
309 }; | 309 }; |
310 | 310 |
| 311 class CV { public: |
| 312 static const int i; |
| 313 typedef int t; |
| 314 void m(t); |
| 315 void m(t) const; |
| 316 void m(t) volatile; |
| 317 void m(t) const volatile; |
| 318 }; |
| 319 const int CV::i = 42; |
| 320 #ifdef __GNUC__ |
| 321 # define ATTRIBUTE_USED __attribute__((used)) |
| 322 #else |
| 323 # define ATTRIBUTE_USED |
| 324 #endif |
| 325 ATTRIBUTE_USED void CV::m(CV::t) {} |
| 326 ATTRIBUTE_USED void CV::m(CV::t) const {} |
| 327 ATTRIBUTE_USED void CV::m(CV::t) volatile {} |
| 328 ATTRIBUTE_USED void CV::m(CV::t) const volatile {} |
| 329 int CV_f (int x) |
| 330 { |
| 331 return x + 1; |
| 332 } |
| 333 |
311 int | 334 int |
312 test_function (int argc, char* argv[]) // test_function | 335 test_function (int argc, char* argv[]) // test_function |
313 { // test_function | 336 { // test_function |
314 derived d; | 337 derived d; |
315 void (derived::*pfunc) (void) const = &derived::a_function; | 338 void (derived::*pfunc) (void) const = &derived::a_function; |
316 (d.*pfunc) (); | 339 (d.*pfunc) (); |
317 | 340 |
318 base a (1), b (3), c (8); | 341 base a (1), b (3), c (8); |
319 (void) a.overload (); | 342 (void) a.overload (); |
320 (void) a.overload (static_cast<int> (0)); | 343 (void) a.overload (static_cast<int> (0)); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 policyd5 pd5 (int_tclass); | 444 policyd5 pd5 (int_tclass); |
422 pd5.function (); | 445 pd5.function (); |
423 | 446 |
424 base1 b1 (3); | 447 base1 b1 (3); |
425 | 448 |
426 r = a; | 449 r = a; |
427 char* str = a; | 450 char* str = a; |
428 fluff* flp = a; | 451 fluff* flp = a; |
429 fluff** flpp = a; | 452 fluff** flpp = a; |
430 | 453 |
| 454 CV_f(CV::i); |
| 455 |
431 return 0; | 456 return 0; |
432 } | 457 } |
433 | 458 |
434 int | 459 int |
435 main (int argc, char* argv[]) | 460 main (int argc, char* argv[]) |
436 { | 461 { |
437 int i; | 462 int i; |
438 | 463 |
439 /* Call the test function repeatedly, enough times for all our tests | 464 /* Call the test function repeatedly, enough times for all our tests |
440 without running forever if something goes wrong. */ | 465 without running forever if something goes wrong. */ |
441 for (i = 0; i < 1000; i++) | 466 for (i = 0; i < 1000; i++) |
442 test_function (argc, argv); | 467 test_function (argc, argv); |
443 | 468 |
444 return 0; | 469 return 0; |
445 } | 470 } |
OLD | NEW |