Hi folks,

I stumbled over a little error in Qt creator today.

Assume you have a class with a data member that has no default constructor, and 
the constructor may throw an exception.

class Foo {
public:
    Foo(int x) { if (x = 42) throw nasty_error;}
    // no default constructor
};


Now suppose you use this class as a data member in another class, and you want 
to catch a possible exception happening in the initialization of the member.

class Bar {
    Foo member_;

public:
    Bar(int x)
    try : 
        member_(x)
    {
        // constructor body
    } catch (nasty_error& error) 
    {
        // handle nasty error
    }
};

While this gets compiled flawlessly by gcc 4.2, Qt-creator 2.2 for Mac Cocoa 
64bit underlines the try and the constructor body red, claiming "expected a 
declaration".

I know this syntax is rarely used and pretty obscure. It would be nice to have 
it recognized by Qt-creator though.

Regards,
Philipp Münzel
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-creator

Reply via email to