This paper presents changes to the core-language sections of the C++ Working Paper N2800 in response to those National Body comments (re C++0x CD1) that the Core Working Group agreed to handle as essentially editorial changes, but felt that additional wording guidance would be beneficial for the Project Editor.
Amemory locationmemory location is either an object of scalar type or a maximal sequence of adjacent bit-fields all having non-zero width. ...
[ Note: ... It is not safe to concurrently update two bit-fields in the same struct if all fields between them are also bit-fields of non-zero width, no matter what the sizes of those intervening bit-fields happen to be. -- end note ]
... Whether each nonempty sequence of white-space characters other than new-line is retained or replaced by one space character isimplementation-definedunspecified. ...
... [ Example: ... the implementation will implicitly define functions to make the definition of C equivalent tostruct C { std::string s; C()-- end example ] ...: s(){ } C(const C& x): s(x.s) { } C& operator=(const C& x) { s = x.s; return *this; } ~C() { } };
...
- the type
T
is the subject of analignof
expression (5.3.6 expr.alignof)., or- an exception-declaration has type
T
, reference toT
, or pointer toT
(15.3 except.handle)
The point of declaration for a class or class template first declared by a class-specifier is immediately after theNote to the editor: We suggest to italicize "identifier" here because it refers to a specific part of the grammar, not the general concept.identifieridentifier or simple-template-id (if any) in its class-head (Clause 9 class). ...
- a namespace (7.3 basic.namespace)
, unless it is declared within an unnamed namespace.
constexpr
with the main
functionA program that declaresmain
to beinline
or,static
, orconstexpr
is ill-formed.
signed char
vs. char
...
- No two signed integer types other than
char
andsigned char
(ifchar
is signed) shall have the same rank, even if they have the same represesentation....
- The rank of any unsigned integer type shall equal the rank of the corresponding signed integer type.
- the rank of
char
shall equal the rank ofsigned char
andunsigned char
.
Primary expressions are literals, names, names qualified by the scope resolution operator...::
, and lambda expressions.
......
- The cv-qualifier-seq is absent if the lambda expression is
mutable
, and it isconst
otherwise.- The attribute-specifier and ref-qualifier are both absent.
When there is no parameter for a given argument, the argument is
passed in such a way that the receiving function can obtain the value
of the argument by invoking va_arg
(18.9
support.runtime).
[ Note: This paragraph does not apply to arguments passed to a
function parameter pack. Function parameter packs are expanded during
template instantiation (14.5.3 temp.variadic), thus each such argument
has a corresponding parameter when a function template specialization
is actually called. --end note ] ...
Editing note: No change to 4.1p2 conv.lval (ISO C does not have rvalues), 8.5.3p5b2 dcl.init.ref and 8.5.4p3b4 dcl.init.list (example is highlighting the non-lvalueness).
Change section 2.13.5 lex.bool paragraph 1 as indicated:The Boolean literals are the keywords false and true. Such literalsChange in section 5.2.5 expr.ref paragraph 4 bullet 3 sub-bullet 2 and bullet 5 as indicated:have type bool. They are not lvaluesare rvalues and have typebool
.
Change in 14.1 temp.param paragraph 6 as indicated:
- ...
...
- Otherwise, if
E1.E2
refers to a non-static member function, and the type ofE2
is "function of parameter-type-list cv returningT
", thenE1.E2
isnot an lvaluean rvalue. ...- If
E2
is a member enumerator, and the type ofE2
isT
, the expressionE1.E2
isnot an lvaluean rvalue. ...
A non-type non-reference template-parameter isnot an lvaluean rvalue. ...
- If, in the most derived object pointed (referred) to by
v
,v
points (refers) to a public base class subobject of aT
object, and only one object of typeT
is derived from the subobject pointed (referred) to byv
the resultis a pointer (an lvalue referring)points (refers) to thatT
object.- Otherwise, if 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
...T
, that is unambiguous and public, the resultis a pointer (an lvalue referring)points (refers) to theT
subobject of the most derived object.
The result of atypeid
expression is an lvalue of static typeconst std::type_info
(18.6.1 type.info) and dynamic typeconst std::type_info
orconst name
where name is an implementation-defined class publicly derived fromstd::type_info
which preserves the behavior described in 18.6.1 type.info [ Footnote: ... ] ...
...Change section 5.2.9 expr.static.cast paragraph 3 as indicated:It is an lvalue if the type cast to is an lvalue reference; otherwise, it is an rvalue....The result is an rvalue....
...The result is an lvalue if T is an lvalue reference type (8.3.2 dcl.ref), and an rvalue otherwise....
The mapping performed by[ Note:reinterpret_cast
is implementation-defined.itThe mapping performed byreinterpret_cast
might, or might not, produce a representation different from the original value. -- end note ]
Thereinterpret_cast
operator shall not cast away constness (5.2.11 expr.const.cast). [ Note:see 5.2.11 for the definition of "casting away constness".Subject to the restrictions in this section, an expression may be cast to its own type using a reinterpret_cast operator. -- end note ]
... [ Note: Except as described in 3.7.4.3 basic.stc.dynamic.safety, the result of such a conversion will not be a safely-derived pointer value. ]
The result of each of the following unary operators is an rvalue.
The result is abool
.All side effects of the first expression except for destruction of temporaries (12.2 class.temporary) happen before the second expression is evaluated.If the second expression is evaluated, every value computation and side effect associated with the first expression is sequenced before every value computation and side effect associated with the second expression.
... Outside of a constrained context, the late-checked block hasno effectthe same meaning as if thelate_check
keyword were absent. ...
decl-specifier: storage-class-specifier type-specifier function-specifier friend typedef constexpralignment-specifier
- if
e
is an unparenthesized id-expression or class member access (5.2.5 expr.ref),decltype(e)
is the type of the entity named bye
. If there is no such entity, or ife
names a set of overloaded functions, the program is ill-formed;
/*CompilationTranslation unit A. */ struct foo { int* a; int* b; };struct foo* foo_head[10];std::atomic<struct foo *> foo_head[10]; int foo_array[10][10]; struct foo* f [[carries_dependency]] (int i) { return foo_head[i].load(memory_order_consume); } int g(int* x, int* y [[carries_dependency]]) { return kill_dependency(foo_array[*x][*y]); } /*CompilationTranslation unit B. */ struct foo* f [[carries_dependency]] (int i); int* g(int* x, int* y [[carries_dependency]]); int c = 3; void h(int i) { struct foo* p; p = f(i); do_something_with(g(&c, p->a)); do_something_with(g(p->a, &c)); }
The annotation on functionf
means that the return value carries a dependency out off
, so that theimplementation need constrain ordering upon return fromimplementations off
f
and its caller may choose to preserve dependencies instead of emitting hardware memory ordering instructions (a.k.a. fences).
Functiong
's second argument is annotated, but its first argument is not. Therefore, functionh
's first call tog
carries a dependency intog
, but its second call does not. The implementation might need toconstrain orderinginsert a fence prior to the second call tog
.
...complex g = { 1, 2 }; //error: constructor is requiredconstruct complex(1,2) using complex(double,double) copy it into g
When the exception-declaration specifies a class type, a copy constructor is used to initialize either the object declared in the exception-declaration or, if the exception-declaration does not specify a name, a temporary object of that type.The object declared in an exception-declaration or, if the exception-declaration does not specify a name, a temporary (12.2 class.temporary) is copy-initialized (8.5 dcl.init) from the exception object. The object shall not have an abstract class type. The object is destroyed when the handler exits, after the destruction of any automatic objects initialized within the handler.The copy constructor and destructor shall be accessible in the context of the handler. If the copy constructor and destructor are implicitly declared (12.8 class.copy), such a use in the handler causes these functions to be implicitly defined; otherwise, the program shall provide a definition for these functions.
The copy constructor and destructor associated with the object shall be accessible even if the copy operation is elided (12.8 class.copy).
.... An exception-specification shall not appear in a typedef declaration or alias-declaration. ...
- when the exception handling mechanism, after completing evaluation of the expression to be thrown but before the exception is caught (15.1 except.throw), calls a
userfunction that exits via an uncaught exception, [ Footnote: ... ]