[PATCH] D122981: [Clang] CWG 1394: Incomplete types as parameters of deleted functions

PoYao Chang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 7 22:28:01 PDT 2022

rZhBoYao marked an inline comment as done.
rZhBoYao added inline comments.

Comment at: clang/include/clang/Sema/Sema.h:2899-2909
+    /// C++ [dcl.fct.def.general]p1
+    /// function-body:
+    ///   = delete ;
+    ///   = default ;
+    Delete,
+    Default,
ChuanqiXu wrote:
> Agree to @erichkeane 
With all due respect, this code suggestion doesn't make any sense to me. My best guess is @ChuanqiXu was thinking the order specified by the grammar as noted in [[ https://eel.is/c++draft/dcl.fct.def.general#nt:function-body | dcl.fct.def.general p1 ]]. Even if that was the case, `CompoundStmt` is not quite right either. Also, differentiating `ctor-initializer[opt] compound-statement` and `function-try-block` is meaningless here, hence the name `Other`.

I adopted the same order as to how `Parser::ParseFunctionDefinition` has always been parsing `function-body`. The order is not significant in any meaningful way as each of the 4 grammar productions of `function-body` is VERY different and mutually exclusive. Putting `Delete` and `Default` upfront not only emphasizes the "specialness" of them but also conveys how we handle `function-body`.

What say you, @erichkeane ?



More information about the cfe-commits mailing list