Skip to content

Do not use \tcode for non-syntax. #1584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 22 additions & 45 deletions source/access.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
\begin{itemize}
\item
\indextext{access control!\idxcode{private}}%
\tcode{private};
private;
that is, its name can be used only by members and friends
of the class in which it is declared.
\item
\indextext{access control!\idxcode{protected}}%
\tcode{protected};
protected;
that is, its name can be used only by members and friends
of the class in which it is declared, by classes derived from that class, and by their
friends (see~\ref{class.protected}).
\item
\indextext{access control!\idxcode{public}}%
\tcode{public};
public;
that is, its name can be used anywhere without access restriction.
\end{itemize}

Expand All @@ -44,12 +44,8 @@
\tcode{private}
by default.
Members of a class defined with the keywords
\tcode{struct}
or
\tcode{union}
are
\tcode{public}
by default.
\tcode{struct} or \tcode{union}
are public by default.
\begin{example}

\begin{codeblock}
Expand All @@ -68,8 +64,7 @@
referred to from declarations or expressions.
\begin{note}
Access control applies to names nominated by
\tcode{friend}
declarations\iref{class.friend} and
friend declarations\iref{class.friend} and
\grammarterm{using-declaration}{s}\iref{namespace.udecl}.
\end{note}
In the case of overloaded function names, access control is applied to
Expand Down Expand Up @@ -289,35 +284,23 @@
If a class is declared to be a base class\iref{class.derived} for another class using the
\tcode{public}
access specifier, the
\tcode{public}
members of the base class are accessible as
\tcode{public}
members of the derived class and
\tcode{protected}
members of the base class are accessible as
\tcode{protected}
members of the derived class.
public members of the base class are accessible as
public members of the derived class and
protected members of the base class are accessible as
protected members of the derived class.
If a class is declared to be a base class for another class using the
\tcode{protected}
access specifier, the
\tcode{public}
and
\tcode{protected}
members of the base class are accessible as
\tcode{protected}
members of the derived class.
public and protected members of the base class are accessible as
protected members of the derived class.
If a class is declared to be a base class for another class using the
\tcode{private}
private
access specifier, the
\tcode{public}
and
\tcode{protected}
members of the base class are accessible as
\tcode{private}
public and protected
members of the base class are accessible as private
members of the derived class.\footnote{As specified previously in \ref{class.access},
private members of a base class remain inaccessible even to derived classes
unless
\tcode{friend}
unless friend
declarations within the base class definition are used to grant access explicitly.}

\pnum
Expand Down Expand Up @@ -673,7 +656,7 @@
\end{example}

\pnum
A \tcode{friend} declaration that does not declare a function
A friend declaration that does not declare a function
shall have one of the following forms:

\begin{ncsimplebnf}
Expand All @@ -682,12 +665,12 @@
\terminal{friend} typename-specifier \terminal{;}
\end{ncsimplebnf}

\begin{note} A \tcode{friend} declaration may be the
\begin{note} A friend declaration may be the
\term{declaration} in a \grammarterm{template-declaration}
(\ref{temp}, \ref{temp.friend}).\end{note} If the
type specifier in a \tcode{friend} declaration designates a (possibly
cv-qualified) class type, that class is declared as a friend; otherwise, the
\tcode{friend} declaration is ignored. \begin{example}
friend declaration is ignored. \begin{example}

\begin{codeblock}
class C;
Expand Down Expand Up @@ -720,8 +703,7 @@

\pnum
\indextext{declaration!overloaded name and \tcode{friend}}%
When a
\tcode{friend}
When a friend
declaration refers to an overloaded name or operator, only the function specified
by the parameter types becomes a friend.
A member function of a class
Expand Down Expand Up @@ -758,8 +740,7 @@

\pnum
Such a function is implicitly an inline function\iref{dcl.inline}.
A
\tcode{friend}
A friend
function defined in a class is in the (lexical) scope of the class in which it is defined.
A friend function defined outside the class is not\iref{basic.lookup.unqual}.

Expand All @@ -775,11 +756,7 @@
A name nominated by a friend declaration shall be accessible in the scope of the
class containing the friend declaration.
The meaning of the friend declaration is the same whether the friend declaration
appears in the
\tcode{private},
\tcode{protected}
or
\tcode{public}\iref{class.mem}
appears in the private, protected, or public\iref{class.mem}
portion of the class
\grammarterm{member-specification}.

Expand Down
10 changes: 5 additions & 5 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@
\end{example}
\begin{note}
When looking for a prior declaration of a class
or function introduced by a \tcode{friend} declaration, scopes outside
or function introduced by a friend declaration, scopes outside
of the innermost enclosing namespace scope are not considered;
see~\ref{namespace.memdef}. \end{note} \begin{note} \ref{basic.scope.class}
further describes the restrictions on the use of names in a class
Expand Down Expand Up @@ -1344,16 +1344,16 @@
definitions. \end{note}

\pnum
Name lookup for a name used in the definition of a \tcode{friend}
Name lookup for a name used in the definition of a friend
function\iref{class.friend} defined inline in the class granting
friendship shall proceed as described for lookup in member function
definitions. If the \tcode{friend} function is not defined in the class
granting friendship, name lookup in the \tcode{friend} function
definitions. If the friend function is not defined in the class
granting friendship, name lookup in the friend function
definition shall proceed as described for lookup in namespace member
function definitions.

\pnum
In a \tcode{friend} declaration naming a member function, a name used in
In a friend declaration naming a member function, a name used in
the function declarator and not part of a \grammarterm{template-argument}
in the \grammarterm{declarator-id} is first looked up in the scope of the
member function's class\iref{class.member.lookup}. If it is not found,
Expand Down
14 changes: 7 additions & 7 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
friend Vector operator*(const Matrix&, const Vector&);
};
\end{codeblock}
Declaration of \tcode{friend}s is described in~\ref{class.friend},
Declaration of friends is described in~\ref{class.friend},
operator functions in~\ref{over.oper}.
\end{example}
\end{note}
Expand Down Expand Up @@ -639,10 +639,10 @@
The
\grammarterm{member-declarator-list} can be omitted only after a
\grammarterm{class-specifier} or an \grammarterm{enum-specifier} or in a
\tcode{friend} declaration\iref{class.friend}. A
friend declaration\iref{class.friend}. A
\grammarterm{pure-specifier} shall be used only in the declaration of a
virtual function\iref{class.virtual}
that is not a \tcode{friend} declaration.
that is not a friend declaration.

\pnum
The optional \grammarterm{attribute-specifier-seq} in a \grammarterm{member-declaration}
Expand Down Expand Up @@ -851,7 +851,7 @@
\begin{note}
There can be at most one definition of a non-inline member function in
a program. There may be more than one
\tcode{inline} member function definition in a program.
inline member function definition in a program.
See~\ref{basic.def.odr} and~\ref{dcl.inline}.
\end{note}

Expand Down Expand Up @@ -889,11 +889,11 @@
\pnum
\begin{note}
A \tcode{static} local variable or local type in a member function always refers to
the same entity, whether or not the member function is \tcode{inline}.
the same entity, whether or not the member function is inline.
\end{note}

\pnum
Previously declared member functions may be mentioned in \tcode{friend} declarations.
Previously declared member functions may be mentioned in friend declarations.

\pnum
\indextext{local class!member function in}%
Expand Down Expand Up @@ -1724,7 +1724,7 @@
allowed in a declaration of an anonymous union in a class scope.
\indextext{access control!anonymous \tcode{union}}%
\indextext{restriction!anonymous \tcode{union}}%
An anonymous union shall not have \tcode{private} or \tcode{protected}
An anonymous union shall not have private or protected
members\iref{class.access}. An anonymous union shall not have
member functions.

Expand Down
10 changes: 5 additions & 5 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@
declaration to which the name in the
\grammarterm{elaborated-type-specifier} refers. This rule also applies to
the form of \grammarterm{elaborated-type-specifier} that declares a
\grammarterm{class-name} or \tcode{friend} class since it can be construed
\grammarterm{class-name} or friend class since it can be construed
as referring to the definition of the class. Thus, in any
\grammarterm{elaborated-type-specifier}, the \tcode{enum} keyword
shall be
Expand Down Expand Up @@ -2515,10 +2515,10 @@
\end{example}

\pnum
If a \tcode{friend} declaration in a non-local class first declares a
If a friend declaration in a non-local class first declares a
class, function, class template or function template\footnote{this implies that the name of the class or function is unqualified.}
the friend is a member of the innermost enclosing
namespace. The \tcode{friend} declaration does not by itself make the name
namespace. The friend declaration does not by itself make the name
visible to unqualified lookup\iref{basic.lookup.unqual} or qualified
lookup\iref{basic.lookup.qual}. \begin{note} The name of the friend will be
visible in its namespace if a matching declaration is provided at namespace
Expand All @@ -2528,12 +2528,12 @@
name lookup that considers functions from namespaces and classes
associated with the types of the function
arguments\iref{basic.lookup.argdep}. If the
name in a \tcode{friend} declaration is neither qualified nor a
name in a friend declaration is neither qualified nor a
\grammarterm{template-id} and the declaration is a function or an
\grammarterm{elaborated-type-specifier}, the lookup to determine whether
the entity has been previously declared shall not consider any scopes
outside the innermost enclosing namespace. \begin{note} The other forms of
\tcode{friend} declarations cannot declare a new member of the innermost
friend declarations cannot declare a new member of the innermost
enclosing namespace and thus follow the usual lookup rules.
\end{note}
\begin{example}
Expand Down
2 changes: 1 addition & 1 deletion source/derived.tex
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@
cannot be a non-member\iref{dcl.fct.spec} function. Nor can a virtual
function be a static member, since a virtual function call relies on a
specific object for determining which function to invoke. A virtual
function declared in one class can be declared a \tcode{friend} in
function declared in one class can be declared a friend~(\ref{class.friend}) in
another class.
\end{note}

Expand Down
8 changes: 4 additions & 4 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@
A member of a closure type shall not be
explicitly instantiated\iref{temp.explicit},
explicitly specialized\iref{temp.expl.spec}, or
named in a \tcode{friend} declaration\iref{class.friend}.
named in a friend declaration\iref{class.friend}.

\rSec3[expr.prim.lambda.capture]{Captures}%

Expand Down Expand Up @@ -2629,14 +2629,14 @@

\begin{itemize}
\item If, in the most derived object pointed (referred) to by \tcode{v},
\tcode{v} points (refers) to a \tcode{public} base class subobject of a
\tcode{v} points (refers) to a public base class subobject of a
\tcode{C} object, and if only one object of type \tcode{C} is derived
from the subobject pointed (referred) to by \tcode{v} the result points (refers) to that \tcode{C} object.

\item Otherwise, if \tcode{v} points (refers) to a \tcode{public} base
\item Otherwise, if \tcode{v} points (refers) to a public base
class subobject of the most derived object, and the type of the most
derived object has a base class, of type \tcode{C}, that is unambiguous
and \tcode{public}, the result points (refers) to the
and public, the result points (refers) to the
\tcode{C} subobject of the most derived object.

\item Otherwise, the
Expand Down
7 changes: 3 additions & 4 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2707,7 +2707,7 @@
It is unspecified whether any
non-member
functions in the \Cpp standard library are defined as
\tcode{inline}\iref{dcl.inline}.
inline\iref{dcl.inline}.

\pnum
A call to a non-member function signature
Expand Down Expand Up @@ -2747,7 +2747,7 @@

\pnum
It is unspecified whether any member functions in the \Cpp standard library are defined as
\tcode{inline}\iref{dcl.inline}.
inline\iref{dcl.inline}.

\pnum
For a non-virtual member function described in the \Cpp standard library,
Expand Down Expand Up @@ -2856,8 +2856,7 @@
\indextext{protection}%
It is unspecified whether any function signature or class described in
\ref{\firstlibchapter} through \ref{\lastlibchapter} and \ref{depr} is a
\tcode{friend}
of another class in the \Cpp standard library.
friend of another class in the \Cpp standard library.
\indextext{specifier!\idxcode{friend}}

\rSec3[derivation]{Derived classes}
Expand Down
2 changes: 1 addition & 1 deletion source/locales.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@
is provided so that the member functions on type
\tcode{char}
can be implemented
\tcode{inline}.\footnote{Only the
inline.\footnote{Only the
\tcode{char}
(not
\tcode{unsigned char}
Expand Down
6 changes: 0 additions & 6 deletions source/numerics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6746,12 +6746,6 @@
matrix class nor a field class.
However, it is a very useful building block for designing such classes.}

\pnum
An implementation is permitted to qualify any of the functions declared in
\tcode{<valarray>}
as
\tcode{inline}.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is erasing the whole paragraph rather than just the tcode bit. Was that intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the statement is entirely redundant with [global.functions] p1

It is unspecified whether any non-member functions in the C++ standard library are defined as inline (10.1.6).

and [member.functions] p1

It is unspecified whether any member functions in the C++ standard library are defined as inline (10.1.6).

Copy link
Contributor

@Eelis Eelis Mar 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, thanks, was just checking because this edit doesn't match the commit description.

\rSec3[valarray.cons]{\tcode{valarray} constructors}

\indexlibrary{\idxcode{valarray}!constructor}%
Expand Down
Loading