Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


811. Unclear implications of const-qualification

Section:9.2.9.2  [dcl.type.cv]    Status:CD2    Submitter:UK    Date:3 March, 2009

N2800 comment UK 89

[Voted into WP at March, 2010 meeting.]

The normative text in 9.2.9.2 [dcl.type.cv] paragraph 2 reads,

An object declared in namespace scope with a const-qualified type hasinternal linkage unless it is explicitly declaredextern orunless it was previously declared to have external linkage. Avariable of non-volatile const-qualified integral or enumeration typeinitialized by an integral constant expression can be used in integralconstant expressions (7.7 [expr.const]).

These two sentences parallel the specifications of9.2.2 [dcl.stc] paragraph 7 and 7.7 [expr.const].However, the passages are not identical, leading to questions aboutwhether the meanings are the same.

Proposed resolution (October, 2009):

Change 9.2.9.2 [dcl.type.cv] paragraph 2 as follows:

An object declared in namespace scope with a const-qualified typehas internal linkage unless it is explicitly declaredexternor unless it was previously declared to have external linkage. Avariable of non-volatile const-qualified integral or enumeration typeinitialized by an integral constant expression can be used in integralconstant expressions (7.7 [expr.const]). [Note:Declaring a variableconst can affect its linkage(9.2.2 [dcl.stc]) and its usability in constant expressions(7.7 [expr.const]). Asas described in9.5 [dcl.init], the definition of an object or subobject ofconst-qualified type must specify an initializer or be subject todefault-initialization. —end note]



[8]ページ先頭

©2009-2026 Movatter.jp