OSDN Git Service

2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / warn / Wreturn-type-4.C
1 /* PR c++/18313 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wignored-qualifiers" } */
4
5 volatile void bar(); /* { dg-warning "type qualifiers ignored" } */
6
7 struct A
8 {
9     const int bla(); /* { dg-warning "type qualifiers ignored" } */
10     static const A getA(); /* { dg-bogus "type qualifiers" } */
11 };
12
13 template<typename T> const T getfoo(const T def) /* { dg-bogus "type qualifiers ignored" } */
14 { return def; } 
15
16 template<typename T> class Pair
17 {
18     public:
19         T getLeft() const { return T(); }   /* { dg-bogus "type qualifiers ignored" } */
20         const T getRight() const { return T(); } /* { dg-bogus "type qualifiers ignored" } */
21 };
22
23 template <typename T> struct S {
24     const int f();                     /* { dg-warning "type qualifiers ignored" } */
25     const T g();                       /* { dg-bogus "type qualifiers ignored" } */
26     T h();
27 };
28
29 int* testtemplate()
30 {
31     int i;
32
33     Pair<const int> a;
34
35     a.getLeft();
36     a.getRight();
37
38     S<bool> b;
39     b.h();              /* { dg-bogus "type qualifiers ignored" } */
40     b.g();              /* { dg-bogus "type qualifiers ignored" } */
41
42     return getfoo<int*>(&i);
43 }