]> granicus.if.org Git - clang/commitdiff
Diagnose C++11 attributes before fp_contract pragmas.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 15 Nov 2013 21:10:54 +0000 (21:10 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 15 Nov 2013 21:10:54 +0000 (21:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194850 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseStmt.cpp
test/Parser/cxx11-stmt-attributes.cpp

index cf2199aa8ee788c143670a7bd9865600e41714fe..8f537eaa5e79aa386a3324daaecaaa123711c3af 100644 (file)
@@ -327,6 +327,7 @@ Retry:
     return StmtEmpty();
 
   case tok::annot_pragma_fp_contract:
+    ProhibitAttributes(Attrs);
     Diag(Tok, diag::err_pragma_fp_contract_scope);
     ConsumeToken();
     return StmtError();
index 2f727a25bd7ede08064ad24047cf660d9d4fd5aa..9374b58b1f24040fa2f538183f36f0be20157c0b 100644 (file)
@@ -76,4 +76,9 @@ void foo(int i) {
   }
 
   [[carries_dependency]] return; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}}
+
+  {
+    [[ ]] // expected-error {{an attribute list cannot appear here}}
+#pragma STDC FP_CONTRACT ON // expected-error {{can only appear at file scope or at the start of a compound statement}}
+  }
 }