<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1417</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="1417"></A><H4>1417.
  
Pointers/references to functions with cv-qualifiers or <I>ref-qualifier</I>
</H4>
<B>Section: </B>9.3.4.6&#160; [<A href="https://wg21.link/dcl.fct">dcl.fct</A>]
 &#160;&#160;&#160;

 <B>Status: </B>C++14
 &#160;&#160;&#160;

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

 <B>Date: </B>2011-11-17<BR>


<P>[Moved to DR at the September, 2013 meeting.]</P>



<P>It is not sufficiently clear from the existing wording that pointers
and references to function types containing cv-qualifiers or a
<I>ref-qualifier</I> are not permitted and thus would result in a
deduction failure if created during template argument substitution.
Normative wording to that effect should be added to, e.g.,
9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>].</P>

<P><B>Proposed resolution (October, 2012) [SUPERSEDED]:</B></P>

<OL>
<LI><P>Change 9.3.4.2 [<A href="https://wg21.link/dcl.ptr#4">dcl.ptr</A>] paragraph 4 as follows:</P></LI>

<BLOCKQUOTE>

[<I>Note:</I> <DEL>There are no pointers to references</DEL>
<INS>Forming a pointer to reference type is ill-formed</INS>; see
9.3.4.3 [<A href="https://wg21.link/dcl.ref">dcl.ref</A>]. <INS>Forming a pointer to a function type
that has cv-qualifiers or a <I>ref-qualifier</I> is ill-formed; see
9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>].</INS> Since the address of a bit-field
(11.4.10 [<A href="https://wg21.link/class.bit">class.bit</A>]) cannot be taken, a pointer can never point
to a bit-field.  &#8212;<I>end note</I>]

</BLOCKQUOTE>

<LI><P>Change 9.3.4.3 [<A href="https://wg21.link/dcl.ref#6">dcl.ref</A>] paragraph 6 as follows:</P></LI>

<BLOCKQUOTE>

If a <DEL>typedef</DEL> <INS><I>typedef-name</I></INS> (9.2.4 [<A href="https://wg21.link/dcl.typedef">dcl.typedef</A>]<DEL>), a type <I>template-parameter</I> (13.4.2 [<A href="https://wg21.link/temp.arg.type">temp.arg.type</A>])</DEL>, <INS>13.2 [<A href="https://wg21.link/temp.param">temp.param</A>])</INS> or a
<I>decltype-specifier</I> (9.2.9.3 [<A href="https://wg21.link/dcl.type.simple">dcl.type.simple</A>]) denotes a
type <TT>TR</TT> that is a reference to a type <TT>T</TT>, an attempt
to create...

</BLOCKQUOTE>

<LI><P>Add the following as a new paragraph at the end of
9.3.4.3 [<A href="https://wg21.link/dcl.ref">dcl.ref</A>]:</P></LI>

<BLOCKQUOTE>

<INS>[<I>Note:</I> Forming a reference to a function type that has
cv-qualifiers or a <I>ref-qualifier</I> is ill-formed; see
9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>]. &#8212;<I>end note</I>]</INS>

</BLOCKQUOTE>

<LI><P>Change 9.3.4.6 [<A href="https://wg21.link/dcl.fct#6">dcl.fct</A>] paragraph 6 as follows:</P></LI>

<BLOCKQUOTE>

<P>A <INS>function type with a</INS> <I>cv-qualifier-seq</I> or a
<I>ref-qualifier</I> <INS>(including by <I>typedef-name</I>
(9.2.4 [<A href="https://wg21.link/dcl.typedef">dcl.typedef</A>], 13.2 [<A href="https://wg21.link/temp.param">temp.param</A>]) or
<I>decltype-specifier</I> (9.2.9.3 [<A href="https://wg21.link/dcl.type.simple">dcl.type.simple</A>]))</INS> shall
only <DEL>be part of</DEL> <INS>appear as</INS>:</P>

<UL>
<LI><P>...</P></LI>

<LI><P>the <I>type-id</I> of a <I>template-argument</I> for a
<I>type-parameter</I> (<DEL>13.3 [<A href="https://wg21.link/temp.names">temp.names</A>]</DEL>
<INS>13.4.2 [<A href="https://wg21.link/temp.arg.type">temp.arg.type</A>]</INS>).</P></LI>

</UL>

<P><INS>[<I>Example:</I></INS></P>

<PRE>
<INS>   typedef int FIC(int) const;
   FIC f;       //<SPAN CLASS="cmnt"> ill-formed: does not declare a member function</SPAN>
   struct S {
    FIC f;      //<SPAN CLASS="cmnt"> OK</SPAN>
   };
   FIC S::*pm = &amp;S::f; //<SPAN CLASS="cmnt"> OK</SPAN></INS>
</PRE>

<P><INS>&#8212;<I>end example</I>]</INS></P>

<P>The effect of a <I>cv-qualifier-seq</I> in a function declarator...</P>

</BLOCKQUOTE>

<LI><P>Delete the following text from 9.3.4.6 [<A href="https://wg21.link/dcl.fct#10">dcl.fct</A>] paragraph 10
(the example is moved to paragraph 6, as indicated in the
preceding change):</P></LI>

<BLOCKQUOTE>

<DEL>A typedef of a function type whose declarator includes a
<I>cv-qualifier-seq</I> shall be used only to declare the function
type for a non-static member function, to declare the function type to
which a pointer to member refers, or to declare the top-level function
type of another function typedef declaration.  [<I>Example:</I> ...
&#8212;<I>end example</I>]</DEL>

</BLOCKQUOTE>

</OL>

<P><B>Additional note (March, 2013):</B></P>

<P>The issue is being returned to "review" status out of concern that
12.5 [<A href="https://wg21.link/over.built#11">over.built</A>] paragraph 11 requires forming a reference to
a function type that might have a cv-qualifier or ref-qualifier.
</P>

<P><B>Proposed resolution (April, 2013):</B></P>

<OL>
<LI><P>Change 9.3.4.2 [<A href="https://wg21.link/dcl.ptr#4">dcl.ptr</A>] paragraph 4 as follows:</P></LI>

<BLOCKQUOTE>

[<I>Note:</I> <DEL>There are no pointers to references</DEL>
<INS>Forming a pointer to reference type is ill-formed</INS>; see
9.3.4.3 [<A href="https://wg21.link/dcl.ref">dcl.ref</A>]. <INS>Forming a pointer to function type
is ill-formed if the function type has <I>cv-qualifier</I>s or a
<I>ref-qualifier</I>; see 9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>].</INS>
Since the address of a bit-field (11.4.10 [<A href="https://wg21.link/class.bit">class.bit</A>])
cannot be taken, a pointer can never point to a
bit-field. &#8212;<I>end note</I>]

</BLOCKQUOTE>

<LI><P>Change 9.3.4.3 [<A href="https://wg21.link/dcl.ref#6">dcl.ref</A>] paragraph 6:</P></LI>

<BLOCKQUOTE>

If a <DEL>typedef</DEL> <INS><I>typedef-name</I></INS>
(9.2.4 [<A href="https://wg21.link/dcl.typedef">dcl.typedef</A>]<DEL>), a
type <I>template-parameter</I>
(13.4.2 [<A href="https://wg21.link/temp.arg.type">temp.arg.type</A>])</DEL>, <INS>
13.2 [<A href="https://wg21.link/temp.param">temp.param</A>])</INS> or
a <I>decltype-specifier</I> (9.2.9.3 [<A href="https://wg21.link/dcl.type.simple">dcl.type.simple</A>])
denotes a type <TT>TR</TT> that is a reference to a
type <TT>T</TT>, an attempt to create the type &#8220;lvalue
reference to <I>cv</I> <TT>TR</TT>&#8221; creates the type
&#8220;lvalue reference to <TT>T</TT>&#8221;, while an
attempt to create the type &#8220;rvalue reference
to <I>cv</I> <TT>TR</TT>" creates the type <TT>TR</TT>.
[<I>Example:</I>...

</BLOCKQUOTE>

<LI><P>Add the following as a new paragraph at the end of
9.3.4.3 [<A href="https://wg21.link/dcl.ref">dcl.ref</A>]:</P></LI>

<BLOCKQUOTE>

<INS>[<I>Note:</I> Forming a reference to function type is
ill-formed if the function type has <I>cv-qualifier</I>s or
a <I>ref-qualifier</I>; see
9.3.4.6 [<A href="https://wg21.link/dcl.fct">dcl.fct</A>]. &#8212;<I>end note</I>]</INS>

</BLOCKQUOTE>

<LI><P>Change 9.3.4.6 [<A href="https://wg21.link/dcl.fct#6">dcl.fct</A>] paragraph 6 as follows:</P></LI>

<BLOCKQUOTE>

<P>A <INS>function type with a</INS> <I>cv-qualifier-seq</I>
or a <I>ref-qualifier</I> <INS>(including a type named
by <I>typedef-name</I> (9.2.4 [<A href="https://wg21.link/dcl.typedef">dcl.typedef</A>],
13.2 [<A href="https://wg21.link/temp.param">temp.param</A>]))</INS> shall <INS>appear</INS>
only <DEL>be part of</DEL> <INS>as</INS>:</P>

<UL>
<LI><P>the function type for a non-static member function,</P></LI>

<LI><P>the function type to which a pointer to member refers,</P></LI>

<LI><P>the top-level function type of a function typedef
declaration or <I>alias-declaration</I>,</P></LI>

<LI><P>the <I>type-id</I> in the default argument of
a <I>type-parameter</I> (13.2 [<A href="https://wg21.link/temp.param">temp.param</A>]), or</P></LI>

<LI><P>the <I>type-id</I> of a <I>template-argument</I> for
a <I>type-parameter</I> (<DEL>13.3 [<A href="https://wg21.link/temp.names">temp.names</A>]</DEL>
<INS>13.4.2 [<A href="https://wg21.link/temp.arg.type">temp.arg.type</A>]</INS>).</P></LI>

</UL>

<P><INS>[Example:</INS></P>

<PRE>
<INS>   typedef int FIC(int) const;
   FIC f;              //<SPAN CLASS="cmnt"> ill-formed: does not declare a member function</SPAN>
   struct S {
     FIC f;            //<SPAN CLASS="cmnt"> OK</SPAN>
   };
   FIC S::*pm = &amp;S::f; //<SPAN CLASS="cmnt"> OK</SPAN></INS>
</PRE>

<P>
<INS>&#8212;<I>end example</I>]</INS> The effect of
a <I>cv-qualifier-seq</I>...</P>

</BLOCKQUOTE>

<LI><P>Change 9.3.4.6 [<A href="https://wg21.link/dcl.fct#10">dcl.fct</A>] paragraph 10 as follows,
moving the example to paragraph 6 as shown above:</P></LI>

<BLOCKQUOTE>

...&#8212;<I>end example</I>] <DEL>A typedef of a function type
whose declarator includes a <I>cv-qualifier-seq</I> shall be
used only to declare the function type for a non-static
member function, to declare the function type to which a
pointer to member refers, or to declare the top-level
function type of another function typedef declaration.
[<I>Example:</I> ... &#8212;<I>end example</I>]</DEL>

</BLOCKQUOTE>

<LI><P>Change 12.5 [<A href="https://wg21.link/over.built#11">over.built</A>] paragraph 11 as follows:</P></LI>

<BLOCKQUOTE>

<P>For every quintuple <I>(C1, C2, T, CV1, CV2)</I>,
where <I>C2</I> is a class type, <I>C1</I> is the same type
as <I>C2</I> or is a derived class of <I>C2</I>, <I>T</I> is
an object type or a function type, and <I>CV1</I> and
<I>CV2</I> are <I>cv-qualifier-seq</I>s, there exist
candidate operator functions of the form</P>

<UL>
<I>CV12 T</I><TT>&amp; operator-&gt;*(</TT><I>CV1 C1*, CV2 T C2</I><TT>::*);</TT>
</UL>

<P>where <I>CV12</I> is the union of <I>CV1</I> and <I>CV2</I>.
<INS>The return type is shown for exposition only; see
7.6.4 [<A href="https://wg21.link/expr.mptr.oper">expr.mptr.oper</A>] for the determination of the
operator's result type.</INS>
</P>

</BLOCKQUOTE>

</OL>

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