<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1428</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="1428"></A><H4>1428.
  
Dynamic const objects
</H4>
<B>Section: </B>6.9.5&#160; [<A href="https://wg21.link/basic.type.qualifier">basic.type.qualifier</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD3
 &#160;&#160;&#160;

 <B>Submitter: </B>Daniel Kr&#252;gler
 &#160;&#160;&#160;

 <B>Date: </B>2011-12-08<BR>


<P>[Moved to DR at the October, 2012 meeting.]</P>



<P>The definition of &#8220;const object&#8221; in 6.9.5 [<A href="https://wg21.link/basic.type.qualifier#1">basic.type.qualifier</A>] paragraph 1
is:</P>

<BLOCKQUOTE>

The presence of a <TT>const</TT> specifier in a <I>decl-specifier-seq</I>
declares an object of <I>const-qualified object type</I>; such object is
called a <I>const object</I>.

</BLOCKQUOTE>

<P>Because the type of an object created by a <I>new-expression</I> is
given by a <I>type-id</I> or <I>new-type-id</I> rather than with a
<I>decl-specifier-seq</I>, this definition gives the false impression
that objects of dynamic storage duration cannot be const objects.  The
wording should be adjusted to make it clear that they can.</P>

<P><B>Proposed resolution (February, 2012):</B></P>

<OL>
<LI><P>Change 6.9.5 [<A href="https://wg21.link/basic.type.qualifier#1">basic.type.qualifier</A>] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

<P>The term object type (6.8.2 [<A href="https://wg21.link/intro.object">intro.object</A>]) includes the
cv-qualifiers specified <INS>in the <I>decl-specifier-seq</I>
(9.2 [<A href="https://wg21.link/dcl.spec">dcl.spec</A>]), <I>declarator</I> (
9.3 [<A href="https://wg21.link/dcl.decl">dcl.decl</A>]), <I>type-id</I> (9.3.2 [<A href="https://wg21.link/dcl.name">dcl.name</A>]), or
<I>new-type-id</I> (7.6.2.8 [<A href="https://wg21.link/expr.new">expr.new</A>])</INS> when the object
is created. <DEL>The presence of a <TT>const</TT> specifier in a
<I>decl-specifier-seq</I> declares an object of
<I>const-qualified object type</I>; such object is called a <I>const
object</I>.  The presence of a <TT>volatile</TT> specifier in a
<I>decl-specifier-seq</I> declares an object of <I>volatile-qualified object
type</I>; such object is called a <I>volatile object</I>.  The presence of both
<I>cv-qualifiers</I> in a <I>decl-specifier-seq</I> declares an object of
<I>const-volatile-qualified object type</I>; such object is called a <I>const
volatile object</I>.</DEL>
</P>

<UL>
<LI><P><INS>A <I>const object</I> is an object of type <TT>const T</TT>
or a non-mutable subobject of such an object.</INS></P></LI>

<LI><P><INS>A <I>volatile object</I> is an object of type
<TT>volatile T</TT>, a subobject of such an object, or a mutable
subobject of a const volatile object.</INS></P></LI>

<LI><P><INS>A <I>const volatile object</I> is an object of type
<TT>const volatile T</TT>, a non-mutable subobject of such an
object, a const subobject of a volatile object, or a non-mutable
volatile subobject of a const object.</INS></P></LI>

</UL>

<P>The cv-qualified or cv-unqualified versions of a type are distinct
types; however, they shall have the same representation and alignment
requirements (6.9 [<A href="https://wg21.link/basic.types">basic.types</A>]).<SUP>51</SUP>
</P>

</BLOCKQUOTE>

<LI><P>Change 6.9.5 [<A href="https://wg21.link/basic.type.qualifier#3">basic.type.qualifier</A>] paragraph 3 as follows:</P></LI>

<BLOCKQUOTE>

<DEL>Each non-static, non-mutable, non-reference data member of a
const-qualified class object is const-qualified, each non-static,
non-reference data member of a volatile-qualified class object is
volatile-qualified and similarly for members of a const-volatile
class.</DEL> See 9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>] and _N4868_.11.4.3.2 [<A href="https://wg21.link/class.this">class.this</A>] regarding function types...

</BLOCKQUOTE>

</OL>

<BR><BR>
</BODY>
</HTML>
