From 4682d959dff605c86b6ad361acccf839d2f0ccd2 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Sat, 11 Feb 2023 19:42:26 -0800 Subject: [PATCH] CWG2475 Object declarations of type cv void --- source/declarations.tex | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index a63c317a72..40130833b1 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -205,7 +205,7 @@ \pnum If the \grammarterm{decl-specifier-seq} contains the \keyword{typedef} -specifier, the declaration is called a \defnx{typedef declaration}{declaration!typedef} +specifier, the declaration is a \defnx{typedef declaration}{declaration!typedef} and each \grammarterm{declarator-id} is declared to be a \grammarterm{typedef-name}, synonymous with its associated type\iref{dcl.typedef}. @@ -213,11 +213,20 @@ Such a \grammarterm{declarator-id} is an \grammarterm{identifier}\iref{class.conv.fct}. \end{note} -If the -\grammarterm{decl-specifier-seq} contains no \keyword{typedef} specifier, the -declaration is called a \defnx{function declaration}{declaration!function} if -the type associated with a \grammarterm{declarator-id} is a function type\iref{dcl.fct} and -an \defnx{object declaration}{declaration!object} otherwise. +Otherwise, if the type associated with a \grammarterm{declarator-id} +is a function type\iref{dcl.fct}, +the declaration is a \defnx{function declaration}{declaration!function}. +Otherwise, if the type associated with a \grammarterm{declarator-id} +is an object or reference type, the declaration is +an \defnx{object declaration}{declaration!object}. +Otherwise, the program is ill-formed. +\begin{example} +\begin{codeblock} +int f(), x; // OK, function declaration for \tcode{f} and object declaration for \tcode{x} +extern void g(), // OK, function declaration for \tcode{g} + y; // error: \tcode{void} is not an object type +\end{codeblock} +\end{example} \pnum \indextext{definition!declaration as}%