Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wreturn-type-4.C
blob20c34a836a9e7821d22333f05f75010a3ce1ec28
1 /* PR c++/18313 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wignored-qualifiers" } */
5 volatile void bar(); /* { dg-warning "type qualifiers ignored" } */
7 struct A
9     const int bla(); /* { dg-warning "type qualifiers ignored" } */
10     static const A getA(); /* { dg-bogus "type qualifiers" } */
13 template<typename T> const T getfoo(const T def) /* { dg-bogus "type qualifiers ignored" } */
14 { return def; } 
16 template<typename T> class Pair
18     public:
19         T getLeft() const { return T(); }   /* { dg-warning "type qualifiers ignored" } */
20         const T getRight() const { return T(); } /* { dg-bogus "type qualifiers ignored" } */
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();
29 int* testtemplate()
31     int i;
33     Pair<const int> a;
35     a.getLeft();
36     a.getRight();
38     S<bool> b;
39     b.h();              /* { dg-bogus "type qualifiers ignored" } */
40     b.g();              /* { dg-bogus "type qualifiers ignored" } */
42     return getfoo<int*>(&i);