p1.cpp revision d98f708a9b17dc57c1305cd1ab15f72912db7db3
1// RUN: %clang_cc1 -verify -std=c++11 %s 2 3[[carries_dependency, carries_dependency]] int m1(); // expected-error {{attribute 'carries_dependency' cannot appear multiple times in an attribute specifier}} 4[[carries_dependency]] [[carries_dependency]] int m2(); // ok 5[[carries_dependency()]] int m3(); // expected-error {{attribute 'carries_dependency' cannot have an argument list}} 6 7[[carries_dependency]] void f1(); // FIXME: warn here 8[[carries_dependency]] int f2(); // ok 9int f3(int param [[carries_dependency]]); // ok 10[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}} 11int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}} 12int (*f6)() [[carries_dependency]]; // expected-error {{'carries_dependency' attribute cannot be applied to types}} 13 14auto l1 = [](int n [[carries_dependency]]) {}; 15// There's no way to write a lambda such that the return value carries 16// a dependency, because an attribute applied to the lambda appertains to 17// the *type* of the operator() function, not to the function itself. 18auto l2 = []() [[carries_dependency]] {}; // expected-error {{'carries_dependency' attribute cannot be applied to types}} 19