1 // PR c++/42701
2 // Test for error-recovery on code that is ill-formed by DR 147.
3 
4 namespace Glib {
5     class ustring {
6     public:
7         typedef unsigned size_type;
8         ustring(const char* src, size_type n);
9         ustring(const char* src);
10     };
11 }
12 namespace Gdk {
13     class Color {
14     public:
15         explicit Color(const Glib::ustring& value);
16     };
17 }
18 namespace Gtk {
19     enum StateType { STATE_NORMAL };
20     class Widget   {
21     public:
22         void modify_bg(StateType state, const Gdk::Color& color);
23     };
24     class Label {
25     public:
26         void set_text(const Glib::ustring &str);
27     };
28 }
29 typedef enum Result { eSuccess = 0 } Result;
30 class MainWindow  {
31     void update_status(Result result);
32     Gtk::Widget status_frame;
33     Gtk::Label status_label;
34 };
update_status(Result result)35 void MainWindow::update_status(Result result) {
36     switch (result) {
37         status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("green")); // { dg-error "" }
38         status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("red")); // { dg-error "" }
39         status_label.set_text("Out of memory");
40     }
41 }
42