28 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s2 3#if !__has_extension(statement_attributes_with_gnu_syntax)4#error "We should have statement attributes with GNU syntax support"5#endif6 7template <typename T = void>8class __attribute__((nomerge)) A {9 // expected-error@-1 {{'nomerge' attribute only applies to functions, statements and variables}}10};11 12class B : public A<> {13public:14 void bar();15};16 17void bar();18 19void foo(A<> *obj) {20 __attribute__((nomerge)) static_cast<B *>(obj)->bar();21 __attribute__((nomerge))[obj]() { static_cast<B *>(obj)->bar(); }22 ();23 __attribute__(()) try {24 bar();25 } catch (...) {26 }27}28