public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14453] New: Parse error when calling a static member template function with an explict type parameter.
@ 2004-03-06 1:41 cakoose at yahoo dot com
2004-03-06 2:11 ` [Bug c++/14453] " gdr at integrable-solutions dot net
2004-03-06 3:29 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: cakoose at yahoo dot com @ 2004-03-06 1:41 UTC (permalink / raw)
To: gcc-bugs
if "A" is a type parameter. I get a parse error when I try doing:
A::Run <int> ();
(Where "Run" is expected to be a static member template function).
The exact rules for templates confuse me so I'm not sure if it's a bug. The
reason I'm reporting it is because another compiler (the one that comes with
Greenhills Software's MULTI 4.0) accepts the code and produces an executable
that works the way I expected it to work. Visual C++ 6.0 gives me a "C1001:
INTERNAL COMPILER ERROR".
"uname -a"
CYGWIN_NT-5.0 KGOUNDAN-W2K 1.5.7(0.109/3/2) 2004-01-30 19:32 i686 unknown
unknown Cygwin
"g++ --version"
g++ (GCC) 3.3.1 (cygming special)
I've included two very similar test cases. The first one is the simplest. I
included the second one because it results in the same parse error I get in my
original code. Neither file has any #includes.
// Test Case 1
template < class Runnable >
void Run()
{
Runnable::Run <int> ();
}
struct Test
{
template <class Target>
static void Run() {}
};
void Start()
{
Run <Test> ();
}
// Output
$ g++ -Wall Test1.cpp
Test1.cpp: In function `void Run()':
Test1.cpp:4: error: syntax error before `>' token
// Test Case 2
template < class Runnable, class Wrapper >
void Run()
{
Runnable::Run <Wrapper::Type> ();
}
struct Test
{
template <class Target>
static void Run() {}
};
struct Wrapper
{
typedef int Type;
};
void Start()
{
Run <Test, Wrapper> ();
}
// Output
$ g++ -Wall Test2.cpp
Test2.cpp: In function `void Run()':
Test2.cpp:4: error: syntax error before `)' token
--
Summary: Parse error when calling a static member template
function with an explict type parameter.
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cakoose at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14453
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/14453] Parse error when calling a static member template function with an explict type parameter.
2004-03-06 1:41 [Bug c++/14453] New: Parse error when calling a static member template function with an explict type parameter cakoose at yahoo dot com
@ 2004-03-06 2:11 ` gdr at integrable-solutions dot net
2004-03-06 3:29 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-03-06 2:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2004-03-06 02:11 -------
Subject: Re: New: Parse error when calling a static member template function with an explict type parameter.
"cakoose at yahoo dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| if "A" is a type parameter. I get a parse error when I try doing:
|
| A::Run <int> ();
This is not compiler bug. Because "A" a is template parameter, the
compiler can not "look" into in it order to determine whether B is a
template or not. You ought to say:
A::template Run<int>();
Note the use of "::template". See our FAQ or consult a recent book on
C++ for more information.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14453
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/14453] Parse error when calling a static member template function with an explict type parameter.
2004-03-06 1:41 [Bug c++/14453] New: Parse error when calling a static member template function with an explict type parameter cakoose at yahoo dot com
2004-03-06 2:11 ` [Bug c++/14453] " gdr at integrable-solutions dot net
@ 2004-03-06 3:29 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-06 3:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-06 03:29 -------
Invalid based on GDR's anyalsis.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14453
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-03-06 3:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-06 1:41 [Bug c++/14453] New: Parse error when calling a static member template function with an explict type parameter cakoose at yahoo dot com
2004-03-06 2:11 ` [Bug c++/14453] " gdr at integrable-solutions dot net
2004-03-06 3:29 ` 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).