1534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
2534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
3534986f2b21e6050bf00163cd6423fd92155a6edRichard Smithvoid foo(int i) {
4534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
56880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] ; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
66880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
76880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] if (0) { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
86880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] for (;;); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
96880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] do { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
106880f492365cc4fa4c941aa83688635003ee7498Michael Han    [[unknown_attribute]] continue; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
11534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith  } while (0);
126880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
13534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
146880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] switch (i) { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
156880f492365cc4fa4c941aa83688635003ee7498Michael Han    [[unknown_attribute]] case 0: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
166880f492365cc4fa4c941aa83688635003ee7498Michael Han    [[unknown_attribute]] default: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
176880f492365cc4fa4c941aa83688635003ee7498Michael Han      [[unknown_attribute]] break; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
18534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith  }
19534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
206880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] goto here; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
216880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] here: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
22534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
236880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] try { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
24534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith  } catch (...) {
25534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith  }
26534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
276880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] return; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
286880f492365cc4fa4c941aa83688635003ee7498Michael Han
29534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
30053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  alignas(8) ; // expected-error {{'alignas' attribute cannot be applied to a statement}}
31053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[noreturn]] { } // expected-error {{'noreturn' attribute cannot be applied to a statement}}
32053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[noreturn]] if (0) { } // expected-error {{'noreturn' attribute cannot be applied to a statement}}
33053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[noreturn]] for (;;); // expected-error {{'noreturn' attribute cannot be applied to a statement}}
34053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[noreturn]] do { // expected-error {{'noreturn' attribute cannot be applied to a statement}}
356880f492365cc4fa4c941aa83688635003ee7498Michael Han    [[unavailable]] continue; // expected-warning {{unknown attribute 'unavailable' ignored}}
366880f492365cc4fa4c941aa83688635003ee7498Michael Han  } while (0);
376880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attributqqq]] while (0); // expected-warning {{unknown attribute 'unknown_attributqqq' ignored}}
386880f492365cc4fa4c941aa83688635003ee7498Michael Han	// TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody)
396880f492365cc4fa4c941aa83688635003ee7498Michael Han
406880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
416880f492365cc4fa4c941aa83688635003ee7498Michael Han
426880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[unused]] switch (i) { // expected-warning {{unknown attribute 'unused' ignored}}
436880f492365cc4fa4c941aa83688635003ee7498Michael Han    [[uuid]] case 0: // expected-warning {{unknown attribute 'uuid' ignored}}
446880f492365cc4fa4c941aa83688635003ee7498Michael Han    [[visibility]] default: // expected-warning {{unknown attribute 'visibility' ignored}}
45053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith      [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
466880f492365cc4fa4c941aa83688635003ee7498Michael Han  }
476880f492365cc4fa4c941aa83688635003ee7498Michael Han
486880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' ignored}}
496880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[noinline]] there: // expected-warning {{unknown attribute 'noinline' ignored}}
506880f492365cc4fa4c941aa83688635003ee7498Michael Han
516880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[lock_returned]] try { // expected-warning {{unknown attribute 'lock_returned' ignored}}
526880f492365cc4fa4c941aa83688635003ee7498Michael Han  } catch (...) {
536880f492365cc4fa4c941aa83688635003ee7498Michael Han  }
546880f492365cc4fa4c941aa83688635003ee7498Michael Han
556880f492365cc4fa4c941aa83688635003ee7498Michael Han  [[weakref]] return; // expected-warning {{unknown attribute 'weakref' ignored}}
566880f492365cc4fa4c941aa83688635003ee7498Michael Han
57053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] ; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
58053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
59053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] if (0) { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
60053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] for (;;); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
61053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] do { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
62053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith    [[carries_dependency]] continue; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}}
63534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith  } while (0);
64053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] while (0); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
65534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
66053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] switch (i) { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}}
67053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith    [[carries_dependency]] case 0: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
68053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith    [[carries_dependency]] default: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
69053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith      [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
70534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith  }
71534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
72053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] goto here; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
73534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
74053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] try { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
75534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith  } catch (...) {
76534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith  }
77534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith
78053214013990ad8ec096dafc64aa7c0ad2b05bc0Richard Smith  [[carries_dependency]] return; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
79aed01168e7593c42ce99aaf1c48deeb8a77dd120Richard Smith
80aed01168e7593c42ce99aaf1c48deeb8a77dd120Richard Smith  {
81aed01168e7593c42ce99aaf1c48deeb8a77dd120Richard Smith    [[ ]] // expected-error {{an attribute list cannot appear here}}
82aed01168e7593c42ce99aaf1c48deeb8a77dd120Richard Smith#pragma STDC FP_CONTRACT ON // expected-error {{can only appear at file scope or at the start of a compound statement}}
83aed01168e7593c42ce99aaf1c48deeb8a77dd120Richard Smith  }
84534986f2b21e6050bf00163cd6423fd92155a6edRichard Smith}
85