Change 3.7.2 basic.stc.auto paragraph 1 as indicated:(削除) The storage class specifiersstatic
andauto
are related to storage duration as described below. (削除ここまで)
Local objects explicitly declaredChange 5.3.4 paragraph 2 as indicated:(削除)auto
or (削除ここまで)register
or not explicitly declaredstatic
orextern
have automatic storage duration. The storage for these objects lasts until the block in which they are created exits.
If theChange 6.4 paragraph 2 as indicated:auto
type-specifier appears in the type-specifier-seq of a new-type-id or type-id of a new-expression,(削除) the type-specifier-seq shall contain no other type-specifiers except cv-qualifiers, and (削除ここまで)the new-expression shall contain a new-initializer of the form( assignment-expression )
... If the auto type-specifier appears in the type-specifier-seq,Add a grammar production to the end of 7.1.6 dcl.type paragraph 1:(削除) the type-specifier-seq shall contain no other type-specifiers except cv-qualifiers, and (削除ここまで)the type of the identifier being declared is deduced from the assignment-expression as described in 7.1.6.4 dcl.spec.auto.
In 7.1.6 dcl.type paragraph 2, change as indicated:type-specifier-seq: type-specifier type-specifier-seqopt
As a general rule, at most one type-specifier is allowed in the complete decl-specifier-seq of a declaration (追記) or in a type-specifier-seq (追記ここまで). The only exceptions to this rule are the following: ...Change 7.1.6.4 dcl.type.auto paragraphs 1-3 as indicated:
(削除) auto can be combined with any type specifier except itself. (削除ここまで)
Remove the grammar production from 8.1 dcl.name paragraph 1:
(削除) Theauto
type-specifier has two meanings depending on the context of its use. In a decl-specifier-seq that contains at least one type-specifier (in addition to auto) that is not a cv-qualifier, theauto
type-specifier specifies that the object named in the declaration has automatic storage duration. The decl-specifier-seq shall contain no storage-class-specifiers. This use of theauto
specifier shall only be applied to names of objects declared in a block (6.3) or to function parameters (8.4). (削除ここまで)
(削除) Otherwise ((追記) The (追記ここまで)auto
appearing with no type specifiers other than cv-qualifiers), the (削除ここまで)auto
type-specifier signifies that the type of an object being declared shall be deduced from its initializer. The name of the object being declared shall not appear in the initializer expression.
(削除) This use of auto (削除ここまで)(追記) Theauto
type-specifier (追記ここまで) is allowed when declaring objects in a block (6.3), in namespace scope (3.3.5), and in a for-init-statement (6.5.3). The decl-specifier-seq shall be followed by one or more init-declarators, each of which shall have a non-empty initializer of either of the following forms:= assignment-expression ( assignment-expression )[ Example: auto x = 5; // OK: x has type int const auto *v = &x, u = 6; // OK: v has type const int*, u has type const int static auto y = 0.0; // OK: y has type double(削除) static auto int z; // error: auto and static conflict (削除ここまで)auto int r; //(削除) OK: r has type int (削除ここまで)(追記) error: auto is not a storage-class-specifier (追記ここまで) -- end example ]
Change 8.3 dcl.meaning paragraph 2 as indicated:(削除) type-specifier-seq: type-specifier type-specifier-seqopt (削除ここまで)
Change 8.3.4 dcl.array paragraph 1 as indicated:(削除) An auto, (削除ここまで)(追記) A (追記ここまで) static, extern, register, mutable, friend, inline, virtual, or typedef specifier applies directly to each declarator-id in an init-declarator-list; the type specified for each declarator-id depends on both the decl-specifier-seq and its declarator.
In a declaration T D where D has the formChange 9.2 class.mem paragraph 6 as indicated:D1 [ constant-expressionopt ]and the type of the identifier in the declaration T D1 is "derived-declarator-type-list T," then the type of the identifier of D is an array type; if the type of the identifier of D contains theauto
(削除) type deduction (削除ここまで)type-specifier, the program is ill-formed. ...
A member shall not be declaredChange the example in 9.8 class.local paragraph 1 as indicated:(削除) to have automatic storage duration (auto, register) or (削除ここまで)with theextern
(追記) orregister
(追記ここまで) storage-class-specifiers.
[ Example:Add an element to C.1.5 diff.dcl (not shown in bold here):int x; void f() { static int s ; int x; extern int g(); struct local { int g() { return x; } // error: x-- end example ](削除) is auto (削除ここまで)(追記) has automatic storage duration (追記ここまで) int h() { return s; } // OK int k() { return ::x; } // OK int l() { return g(); } // OK }; // ... } local* p = 0; // error: local not in scope
7.1.6.4 dcl.type.autoIn the index, remove the entries forChange: The keyword
auto
cannot be used as a storage class specifier.Example:
void f() { auto int x; // valid C, invalid C++ }Rationale: Allowing the use ofauto
to deduce the type of a variable from its initializer results in undesired interpretations ofauto
as a storage class specifier in certain contexts.
Effect on original feature: Deletion of semantically well-defined feature.
Difficulty of converting: Syntactic transformation.
How widely used: Rare.
Change the index entry for(削除) auto destruction of, initialization, auto (削除ここまで)
storage duration, 60(削除) auto (削除ここまで)(追記) automatic (追記ここまで), 61