Bug 12823 - Cannot call member function template of nested class inside template class
Summary: Cannot call member function template of nested class inside template class
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-29 13:15 UTC by bsamwel
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bsamwel 2003-10-29 13:15:31 UTC
AFAICS the following code should compile.


template<int a>
struct foo
{
  struct barney
  {
    template<int c>
    void bar()
    {  
    }
  };

  void baz()
  {
    barney b;
    b.bar<0>(); // (This is line 15.)
  }
};

Comeau's online compiler compiles this snippet just fine. GCC 3.3.2 gives me:

gcc test.cc
test.cc: In member function `void foo<a>::baz()':
test.cc:15: error: parse error before `;' token
Comment 1 Wolfgang Bangerth 2003-10-29 14:43:13 UTC
No, this is invalid code. The type of b is template dependent, so
you need to use the following syntax (which does compile with
gcc):
    b.template bar<0>(); // (This is line 15.)

W.