Topic: Member templates and using declarations


Author: David Krauss <potswa@gmail.com>
Date: Thu, 8 Aug 2013 01:48:17 -0700 (PDT)
Raw View
------=_Part_4473_4968558.1375951697360
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

While I'm suggesting new using declaration syntax, here's another one=20
that's bugged me=85 a member using-declaration cannot import a template-nam=
e.=20
I cannot fathom why. Although a template specialization may be a type or a=
=20
function (or, soon, a variable), a template member of a dependent type is=
=20
just as ambiguous when it is specified using the current syntax. And a=20
using declaration can already introduce alias an identifier to a dependent=
=20
typename, so why not a dependent template-name?

The current grammar specifies

  using-declaration:
    using typenameopt nested-name-specifier unqualified-id ;=20
  What could possibly go wrong if this were simply changed to

  using-declaration:
    using typenameopt qualified-id ;=20
  where qualified-id already allows the template keyword, such that this=20
would be well-formed:

using base::template foo;


--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_4473_4968558.1375951697360
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

While I'm suggesting new using declaration syntax, here's another one that'=
s bugged me=85 a member using-declaration cannot import a template-name. I =
cannot fathom why. Although a template specialization may be a type or a fu=
nction (or, soon, a variable), a template member of a dependent type is jus=
t as ambiguous when it is specified using the current syntax. And a using d=
eclaration can already introduce alias an identifier to a dependent typenam=
e, so why not a dependent template-name?<br><br>The current grammar specifi=
es<br><br>

=09
 =09
 =09
=09
=09
  <div class=3D"page" title=3D"Page 176">
   <div class=3D"layoutArea">
    <div class=3D"column">
     <p><span style=3D"font-size: 9.000000pt; font-family: 'LMRoman9'; font=
-style: italic">using-declaration:<br>&nbsp;&nbsp;&nbsp;
</span><span style=3D"font-size: 9.000000pt; font-family: 'LMMono9'">using =
typename</span><span style=3D"font-size: 6.000000pt; font-family: 'LMRoman7=
'; font-style: italic; vertical-align: -1.000000pt">opt </span><span style=
=3D"font-size: 9.000000pt; font-family: 'LMRoman9'; font-style: italic">nes=
ted-name-specifier unqualified-id </span><span style=3D"font-size: 9.000000=
pt; font-family: 'LMMono9'">;
</span></p>
    </div>
   </div>
  </div>
=09
What could possibly go wrong if this were simply changed to<br><br>

=09
 =09
 =09
=09
=09
  <div class=3D"page" title=3D"Page 176">
   <div class=3D"layoutArea">
    <div class=3D"column">
     <p><span style=3D"font-size: 9.000000pt; font-family: 'LMRoman9'; font=
-style: italic">using-declaration:<br>&nbsp;&nbsp;&nbsp;
</span><span style=3D"font-size: 9.000000pt; font-family: 'LMMono9'">using =
typename</span><span style=3D"font-size: 6.000000pt; font-family: 'LMRoman7=
'; font-style: italic; vertical-align: -1.000000pt">opt </span><span style=
=3D"font-size: 9.000000pt; font-family: 'LMRoman9'; font-style: italic">qua=
lified-id </span><span style=3D"font-size: 9.000000pt; font-family: 'LMMono=
9'">;
</span></p>
    </div>
   </div>
  </div>
=09
where qualified-id already allows the template keyword, such that this woul=
d be well-formed:<br><br><div class=3D"prettyprint" style=3D"background-col=
or: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: sol=
id; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint">=
<div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-=
by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">b=
ase</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">template</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> foo</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span></div></code></div><b=
r><br>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4473_4968558.1375951697360--

.


Author: David Krauss <potswa@gmail.com>
Date: Thu, 8 Aug 2013 17:13:20 -0700 (PDT)
Raw View
------=_Part_103_15155130.1376007201012
Content-Type: text/plain; charset=ISO-8859-1

One special case is an injected-class-name. C++11 has restricted use of an
injected-class-name as a template-name to only a few contexts. I should
probably review this, because use as a template template argument is one of
the allowed contexts despite being the most confusing and poorly-supported.
(Clang at least does not correctly resolve function overload candidate
alternatives accepting the injected-class-name as a template and a type.)

Anyway, it would be nice to do this:

using typename base::template base; // Get the injected-class-name as a
typename and a template.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.



------=_Part_103_15155130.1376007201012
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">One special case is an injected-class-name. C++11 has rest=
ricted use of an injected-class-name as a template-name to only a few conte=
xts. I should probably review this, because use as a template template argu=
ment is one of the allowed contexts despite being the most confusing and po=
orly-supported. (Clang at least does not correctly resolve function overloa=
d candidate alternatives accepting the injected-class-name as a template an=
d a type.)<br><br>Anyway, it would be nice to do this:<br><br><div class=3D=
"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: =
rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: brea=
k-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">base</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">template</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">base</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #800;" class=3D"styled-by-prettify">// Get the injected-cl=
ass-name as a typename and a template.</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span></div></code></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_103_15155130.1376007201012--

.


Author: David Krauss <potswa@gmail.com>
Date: Thu, 8 Aug 2013 18:56:06 -0700 (PDT)
Raw View
------=_Part_184_5829987.1376013366884
Content-Type: text/plain; charset=ISO-8859-1

To allow such a declaration to find function templates, [temp.names]/5
would have to be adjusted:

A name prefixed by the keyword template shall be a template-id or the name
shall refer to a class template.

As is, a template-name for an overload set may only be found when a
template-argument-list is specified. This proposal breaks that assumption.
The statement is somewhat meaningless in the first place, since a
template-name with no template-argument-list and referring to an overload
set is the same as any other name referring to an overload set.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_184_5829987.1376013366884
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">To allow such a declaration to find function templates, [t=
emp.names]/5 would have to be adjusted:<span style=3D"font-size: 10.000000p=
t; font-family: 'LMRoman10'"><br><br></span><div style=3D"margin-left: 40px=
;"><span style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'">A name =
prefixed by the keyword </span><span style=3D"font-size: 10.000000pt; font-=
family: 'LMMono10'">template </span><span style=3D"font-size: 10.000000pt; =
font-family: 'LMRoman10'">shall be a </span><span style=3D"font-size: 10.00=
0000pt; font-family: 'LMRoman10'; font-style: italic">template-id </span><s=
pan style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'">or the name =
shall refer to a class template.
</span>
     =09
   =09
  =09
 =09
=09
<br></div><br>As is, a template-name for an overload set may only be found =
when a template-argument-list is specified. This proposal breaks that assum=
ption. The statement is somewhat meaningless in the first place, since a te=
mplate-name with no template-argument-list and referring to an overload set=
 is the same as any other name referring to an overload set.<br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_184_5829987.1376013366884--

.