public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42085] New: Typedef templates
@ 2009-11-18 0:33 marc dot coiffier at free dot fr
2009-11-18 2:10 ` [Bug c++/42085] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: marc dot coiffier at free dot fr @ 2009-11-18 0:33 UTC (permalink / raw)
To: gcc-bugs
First of all, sorry if I seem redundant, for you may get a lot of requests like
this one, but couldn't you implement an extension (accessible with, for
example, -ftypedef-templates or something) that would allow the code below to
compile as it logically should :
template<class _T>
typedef _T Storage; // a template typedef declaration
class I { // an abstract class
virtual void foo() const=0;
};
template<>
typedef const I& Storage<I>; // a partial specialisation for the abstract class
template<class _T>
class Foo {
Storage<_T> m_data;
/* obviously the class does something else ;) */
};
int main(/* etc. */) {
Foo<A> test;
Foo<int> test2;
return 0;
}
Thanks a bunch if you can, and thanks anyway otherwise :D
PS: I know the standard doesn't allow for typedef templates (and that's why I'm
asking for an extension) but this one would be so darn helpful I couldn't help
but ask anyway.
PS2: I know there is a workaround to do this, but it's ugly and it's impact on
readability and design is disastrous, whereas the syntax above is pretty
readable and well in accordance with the whole of template declaration and
specialisation, since its syntax is the same as when I declare a class or a
function template.
--
Summary: Typedef templates
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: marc dot coiffier at free dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42085
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/42085] Typedef templates
2009-11-18 0:33 [Bug c++/42085] New: Typedef templates marc dot coiffier at free dot fr
@ 2009-11-18 2:10 ` pinskia at gcc dot gnu dot org
2009-11-18 2:14 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-18 2:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-11-18 02:10 -------
I think C++0x (well renamed to C++1x) has something like this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42085
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/42085] Typedef templates
2009-11-18 0:33 [Bug c++/42085] New: Typedef templates marc dot coiffier at free dot fr
2009-11-18 2:10 ` [Bug c++/42085] " pinskia at gcc dot gnu dot org
@ 2009-11-18 2:14 ` pinskia at gcc dot gnu dot org
2009-11-18 18:14 ` marc dot coiffier at free dot fr
2009-11-18 18:47 ` redi at gcc dot gnu dot org
3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-18 2:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2009-11-18 02:13 -------
(In reply to comment #1)
> I think C++0x (well renamed to C++1x) has something like this.
Called template aliases:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
Note GCC does not implement them yet.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42085
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/42085] Typedef templates
2009-11-18 0:33 [Bug c++/42085] New: Typedef templates marc dot coiffier at free dot fr
2009-11-18 2:10 ` [Bug c++/42085] " pinskia at gcc dot gnu dot org
2009-11-18 2:14 ` pinskia at gcc dot gnu dot org
@ 2009-11-18 18:14 ` marc dot coiffier at free dot fr
2009-11-18 18:47 ` redi at gcc dot gnu dot org
3 siblings, 0 replies; 6+ messages in thread
From: marc dot coiffier at free dot fr @ 2009-11-18 18:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from marc dot coiffier at free dot fr 2009-11-18 18:13 -------
(In reply to comment #2)
> (In reply to comment #1)
> > I think C++0x (well renamed to C++1x) has something like this.
>
> Called template aliases:
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
>
> Note GCC does not implement them yet.
>
Thank you, I looked it up and it does seem to match what I want. Do you know of
any compiler (or compiler branch or compiler extension or plugin), even
experimental, that would let me experience this feature, though ? Also, could
you tell me when they plan to release a stable version of a C++1x compiler ?
--
marc dot coiffier at free dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marc dot coiffier at free
| |dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42085
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/42085] Typedef templates
2009-11-18 0:33 [Bug c++/42085] New: Typedef templates marc dot coiffier at free dot fr
` (2 preceding siblings ...)
2009-11-18 18:14 ` marc dot coiffier at free dot fr
@ 2009-11-18 18:47 ` redi at gcc dot gnu dot org
3 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-11-18 18:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from redi at gcc dot gnu dot org 2009-11-18 18:47 -------
(In reply to comment #3)
> you tell me when they plan to release a stable version of a C++1x compiler ?
After the C++1x standard is finished, which might be next year, or might not.
I don't know of any compiler that implements template aliases yet. This is the
wrong place to ask, all you'll learn here is GCC doesn't support them
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42085
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/42085] Typedef templates
[not found] <bug-42085-4@http.gcc.gnu.org/bugzilla/>
@ 2011-08-16 10:21 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2011-08-16 10:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42085
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-08-16 10:19:59 UTC ---
I think clang might have implemented template aliases.
Implementing them in G++ is PR 45114
*** This bug has been marked as a duplicate of bug 45114 ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-08-16 10:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-18 0:33 [Bug c++/42085] New: Typedef templates marc dot coiffier at free dot fr
2009-11-18 2:10 ` [Bug c++/42085] " pinskia at gcc dot gnu dot org
2009-11-18 2:14 ` pinskia at gcc dot gnu dot org
2009-11-18 18:14 ` marc dot coiffier at free dot fr
2009-11-18 18:47 ` redi at gcc dot gnu dot org
[not found] <bug-42085-4@http.gcc.gnu.org/bugzilla/>
2011-08-16 10:21 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).