summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/overload/error3.C
blob: e0003dd88131be682bbbdb87175af28fe6db5b4d (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
// PR c++/42701
// Test for error-recovery on code that is ill-formed by DR 147.

namespace Glib {
    class ustring {
    public:
        typedef unsigned size_type;
        ustring(const char* src, size_type n);
        ustring(const char* src);
    };
}
namespace Gdk {
    class Color {
    public:
        explicit Color(const Glib::ustring& value);
    };
}
namespace Gtk {
    enum StateType { STATE_NORMAL };
    class Widget   {
    public:
        void modify_bg(StateType state, const Gdk::Color& color);
    };
    class Label {
    public:
        void set_text(const Glib::ustring &str);
    };
}
typedef enum Result { eSuccess = 0 } Result;
class MainWindow  {
    void update_status(Result result);
    Gtk::Widget status_frame;
    Gtk::Label status_label;
};
void MainWindow::update_status(Result result) {
    switch (result) {
        status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("green")); // { dg-error "" }
        status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("red")); // { dg-error "" }
        status_label.set_text("Out of memory");
    }
}