view clang/test/Parser/stmt-attributes.cpp @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents 79ff65ed7e25
children
line wrap: on
line source

// RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s

#if !__has_extension(statement_attributes_with_gnu_syntax)
#error "We should have statement attributes with GNU syntax support"
#endif

template <typename T = void>
class __attribute__((nomerge)) A {
  // expected-error@-1 {{'nomerge' attribute only applies to functions, statements and variables}}
};

class B : public A<> {
public:
  void bar();
};

void bar();

void foo(A<> *obj) {
  __attribute__((nomerge)) static_cast<B *>(obj)->bar();
  __attribute__((nomerge))[obj]() { static_cast<B *>(obj)->bar(); }
  ();
  __attribute__(()) try {
    bar();
  } catch (...) {
  }
}