This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3826: Parse error for static nested class member functions
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3826: Parse error for static nested class member functions
- From: tme at lanl dot gov
- Date: 25 Jul 2001 22:38:24 -0000
- Cc: tmonster at lanl dot gov
- Reply-To: tme at lanl dot gov
>Number: 3826
>Category: c++
>Synopsis: Parse error for static nested class member functions
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jul 25 15:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Tom Evans
>Release: gcc-3.0.1 (16-JUL-01 snapshot)
>Organization:
>Environment:
Linux (redhat 7.1) 2 processor
>Description:
In the following:
class Foo
{
class Nested_Foo
{
static void doit() {/*do something*/}
};
};
template<class T>
void do_some_more()
{
T::Nested_Foo::doit();
}
int main()
{
do_some_more<Foo>()
}
The compiler gives the error on (g++ test.cc)
test.cc: In function `void do_something ()':
test.cc:30: parse error before `::'
(see attached test.cc file)
I can add the following in do_some_more()
template<class T>
void do_some_more()
{
typedef typename T:Nested_Foo nf;
nf::doit();
}
and the compiler doesn't have a problem. Is this a parser error or am I doing something wrong.
>How-To-Repeat:
complie attachment
g++ test.cc
>Fix:
See description. I think this is a compiler (parser?) bug.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cc"
Ly8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi1DKystKi0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0vLwovLyB0ZXN0LmNjCi8vIFRob21hcyBNLiBFdmFucwovLyBX
ZWQgSnVsIDI1IDEzOjU1OjA0IDIwMDEKLy8gVGltZS1zdGFtcDogPDAxLzA3LzI1IDE2OjMzOjMw
IHRtZT4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