<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 11, 2015 at 6:59 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Wed, Nov 11, 2015 at 3:53 PM, Nathan Wilson via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: nwilson<br>
Date: Wed Nov 11 17:53:35 2015<br>
New Revision: 252827<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=252827&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=252827&view=rev</a><br>
Log:<br>
Add diagnostics which fall under [dcl.spec.concept]p5<br>
<br>
Summary: Diagnose when a function concept declaration has parameter(s)<br>
<br>
Reviewers: rsmith, faisalv, aaron.ballman, hubert.reinterpretcast<br>
<br>
Subscribers: cfe-commits<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D14352" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14352</a><br>
<br>
Added:<br>
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp<br>
Modified:<br>
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
cfe/trunk/lib/Sema/SemaDecl.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252827&r1=252826&r2=252827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252827&r1=252826&r2=252827&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 11 17:53:35 2015<br>
@@ -1994,6 +1994,8 @@ def err_function_concept_exception_spec<br>
def err_concept_decl_invalid_specifiers : Error<<br>
"%select{variable|function}0 concept cannot be declared "<br>
"'%select{thread_local|inline|friend|constexpr}1'">;<br>
+def err_function_concept_with_params : Error<<br>
+ "function concept cannot have any parameters">;<br>
<br>
// C++11 char16_t/char32_t<br>
def warn_cxx98_compat_unicode_type : Warning<<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=252827&r1=252826&r2=252827&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=252827&r1=252826&r2=252827&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Nov 11 17:53:35 2015<br>
@@ -7607,6 +7607,13 @@ Sema::ActOnFunctionDeclarator(Scope *S,<br>
} else {<br>
Context.adjustExceptionSpec(NewFD, EST_BasicNoexcept);<br>
}<br>
+<br>
+ // C++ Concepts TS [dcl.spec.concept]p5: A function concept has the<br>
+ // following restrictions:<br>
+ // - The declaration's parameter list shall be equivalent to an empty<br>
+ // parameter list.<br>
+ if ((FPT->getNumParams() > 0) || (FPT->isVariadic()))<br></blockquote><div><br></div></div></div><div>You don't need parens around either of these conditions.</div></div></div></div></blockquote><div><br></div><div>Okay. Thanks. I removed them in r252855.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ Diag(NewFD->getLocation(), diag::err_function_concept_with_params);<br>
}<br>
<br>
// C++ Concepts TS [dcl.spec.concept]p2: Every concept definition is<br>
<br>
Added: cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp?rev=252827&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp?rev=252827&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp (added)<br>
+++ cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp Wed Nov 11 17:53:35 2015<br>
@@ -0,0 +1,13 @@<br>
+// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s<br>
+<br>
+template<typename T><br>
+concept bool fcpv(void) { return true; }<br>
+<br>
+template<typename T><br>
+concept bool fcpi(int i = 0) { return true; } // expected-error {{function concept cannot have any parameters}}<br>
+<br>
+template<typename... Ts><br>
+concept bool fcpp(Ts... ts) { return true; } // expected-error {{function concept cannot have any parameters}}<br>
+<br>
+template<typename T><br>
+concept bool fcpva(...) { return true; } // expected-error {{function concept cannot have any parameters}}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>