From: Richard Smith Date: Fri, 15 Nov 2013 21:10:54 +0000 (+0000) Subject: Diagnose C++11 attributes before fp_contract pragmas. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aed01168e7593c42ce99aaf1c48deeb8a77dd120;p=clang Diagnose C++11 attributes before fp_contract pragmas. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194850 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index cf2199aa8e..8f537eaa5e 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -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(); diff --git a/test/Parser/cxx11-stmt-attributes.cpp b/test/Parser/cxx11-stmt-attributes.cpp index 2f727a25bd..9374b58b1f 100644 --- a/test/Parser/cxx11-stmt-attributes.cpp +++ b/test/Parser/cxx11-stmt-attributes.cpp @@ -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}} + } }