1 /* PR c++/18313 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wignored-qualifiers" } */
4 
5 volatile void bar(); /* { dg-warning "type qualifiers ignored" } */
6 // { dg-warning ".volatile.-qualified return type is deprecated" "" { target c++2a } .-1 }
7 
8 struct A
9 {
10     const int bla(); /* { dg-warning "type qualifiers ignored" } */
11     static const A getA(); /* { dg-bogus "type qualifiers" } */
12 };
13 
getfoo(const T def)14 template<typename T> const T getfoo(const T def) /* { dg-bogus "type qualifiers ignored" } */
15 { return def; }
16 
17 template<typename T> class Pair
18 {
19     public:
getLeft()20         T getLeft() const { return T(); }   /* { dg-bogus "type qualifiers ignored" } */
getRight()21         const T getRight() const { return T(); } /* { dg-bogus "type qualifiers ignored" } */
22 };
23 
24 template <typename T> struct S {
25     const int f();                     /* { dg-warning "type qualifiers ignored" } */
26     const T g();                       /* { dg-bogus "type qualifiers ignored" } */
27     T h();
28 };
29 
testtemplate()30 int* testtemplate()
31 {
32     int i;
33 
34     Pair<const int> a;
35 
36     a.getLeft();
37     a.getRight();
38 
39     S<bool> b;
40     b.h();              /* { dg-bogus "type qualifiers ignored" } */
41     b.g();              /* { dg-bogus "type qualifiers ignored" } */
42 
43     return getfoo<int*>(&i);
44 }
45