Skip to content

Commit

Permalink
CWG2475 Object declarations of type cv void
Browse files Browse the repository at this point in the history
  • Loading branch information
burblebee committed Feb 12, 2023
1 parent 6181a4e commit 4682d95
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions source/declarations.tex
Expand Up @@ -205,19 +205,28 @@

\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}.
\begin{note}
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}%
Expand Down

0 comments on commit 4682d95

Please sign in to comment.