aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wreturn-type-4.C
blob: 4f02678e7f9081822bab7cda7edf2030fb77c45b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* PR c++/18313 */
/* { dg-do compile } */
/* { dg-options "-Wignored-qualifiers" } */

volatile void bar(); /* { dg-warning "type qualifiers ignored" } */

struct A
{
    const int bla(); /* { dg-warning "type qualifiers ignored" } */
    static const A getA(); /* { dg-bogus "type qualifiers" } */
};

template<typename T> const T getfoo(const T def) /* { dg-bogus "type qualifiers ignored" } */
{ return def; } 

template<typename T> class Pair
{
    public:
        T getLeft() const { return T(); }   /* { dg-bogus "type qualifiers ignored" } */
        const T getRight() const { return T(); } /* { dg-bogus "type qualifiers ignored" } */
};

template <typename T> struct S {
    const int f();                     /* { dg-warning "type qualifiers ignored" } */
    const T g();                       /* { dg-bogus "type qualifiers ignored" } */
    T h();
};

int* testtemplate()
{
    int i;

    Pair<const int> a;

    a.getLeft();
    a.getRight();

    S<bool> b;
    b.h();              /* { dg-bogus "type qualifiers ignored" } */
    b.g();              /* { dg-bogus "type qualifiers ignored" } */

    return getfoo<int*>(&i);
}