public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13808] New: conversion operator template with template as parameter fails parsing
@ 2004-01-22 3:40 gianni at mariani dot ws
2004-01-22 6:25 ` [Bug c++/13808] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: gianni at mariani dot ws @ 2004-01-22 3:40 UTC (permalink / raw)
To: gcc-bugs
The code below compiles fine under Comeau and VC++7.1.
gcc 3.3.2 gives the following diagnostic:
t2x.cpp:14: error: parse error before `<' token
t2x.cpp:14: error: syntax error before `<' token
t2x.cpp:19: error: parse error before `}' token
t2x.cpp: In function `int main()':
t2x.cpp:33: error: conversion from `X' to non-scalar type `D<char, char>'
requested
make: *** [t2x] Error 1
The "struct C" commented allows this to compile and function as expected which
indicates that there most likely is a parsing error (expecting a typename but
have a template instead). Using the "typename" keyword does not correct the
problem.
struct X
{
// struct C; //uncomment to make this work.
template<typename T, typename A, template<typename,typename> class C>
C<T, A> Func()
{
return C<T, A>();
}
template<typename T, typename A, template<typename,typename> class C >
operator C<T, A> ()
{
return C<T, A>();
}
};
template<typename dpt, typename dpa>
class D
{
};
int main()
{
X x;
x.Func<char, char, D>();
D<char,char> d = x;
}
Credit for finding this problem goes to: Leor Zolman
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=58nt00110jirtteaml6p5o45j6l19le1cl%404ax.com&rnum=9
--
Summary: conversion operator template with template as parameter
fails parsing
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gianni at mariani dot ws
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13808
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/13808] conversion operator template with template as parameter fails parsing
2004-01-22 3:40 [Bug c++/13808] New: conversion operator template with template as parameter fails parsing gianni at mariani dot ws
@ 2004-01-22 6:25 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-22 6:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-22 06:25 -------
Fixed for 3.4 by the new parser.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Keywords| |rejects-valid
Resolution| |FIXED
Target Milestone|--- |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13808
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-22 6:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-22 3:40 [Bug c++/13808] New: conversion operator template with template as parameter fails parsing gianni at mariani dot ws
2004-01-22 6:25 ` [Bug c++/13808] " pinskia at gcc dot gnu dot 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).