This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14453] New: Parse error when calling a static member template function with an explict type parameter.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]