p15.cpp 493 B

123456789101112131415161718192021
  1. // RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
  2. class C {
  3. public:
  4. C(int a, int b);
  5. };
  6. C::C(int a, // expected-note {{previous definition}}
  7. int b) // expected-note {{previous definition}}
  8. try {
  9. int c;
  10. } catch (int a) { // expected-error {{redefinition of 'a'}}
  11. int b; // expected-error {{redefinition of 'b'}}
  12. ++c; // expected-error {{use of undeclared identifier 'c'}}
  13. }
  14. void f(int i) {
  15. struct S {
  16. void g() try {} catch (int i) {}; // OK
  17. };
  18. }