public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/10514: incorrect parsing of template instatiation with pointer-to-member variables
@ 2003-05-16 1:22 giovannibajo
0 siblings, 0 replies; 3+ messages in thread
From: giovannibajo @ 2003-05-16 1:22 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, gianni, nobody
Synopsis: incorrect parsing of template instatiation with pointer-to-member variables
State-Changed-From-To: analyzed->closed
State-Changed-By: bajo
State-Changed-When: Fri May 16 01:22:17 2003
State-Changed-Why:
Duplicate of c++/8222. The code is known to be legal, but
it is currently rejected by GCC up to current mainline.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10514
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/10514: incorrect parsing of template instatiation with pointer-to-member variables
@ 2003-04-28 13:56 reichelt
0 siblings, 0 replies; 3+ messages in thread
From: reichelt @ 2003-04-28 13:56 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, gianni, nobody
Synopsis: incorrect parsing of template instatiation with pointer-to-member variables
State-Changed-From-To: open->analyzed
State-Changed-By: reichelt
State-Changed-When: Mon Apr 28 13:56:14 2003
State-Changed-Why:
Confirmed.
The parser hickups affect all release versions since 2.95.x,
as well as 3.3 branch and mainline.
BTW, not only using
i_1->A::TFUNC_A<w_a,w_b>( m_b1 );
but also writing
i_1->template TFUNC_A<w_a,w_b>( m_b1 );
makes the code compile.
The problem can also be demonstrated with the following code snippet:
============================snip here===============================
struct A
{
template <int> void foo() {}
};
struct B
{
template <int> void bar (A* p)
{
p->foo<0>(); // compiler trouble
}
void baz (A* p)
{
bar<0>(p);
}
};
============================snip here===============================
Regards,
Volker
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10514
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/10514: incorrect parsing of template instatiation with pointer-to-member variables
@ 2003-04-27 15:36 gianni
0 siblings, 0 replies; 3+ messages in thread
From: gianni @ 2003-04-27 15:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 10514
>Category: c++
>Synopsis: incorrect parsing of template instatiation with pointer-to-member variables
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Apr 27 15:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: gianni@mariani.ws
>Release: gcc 3.2.1
>Organization:
>Environment:
Linux X86 RH 7.2
>Description:
The lines in question (see listing below) are:
i_1->A::TFUNC_A<w_a,w_b>( m_b1 );
i_1->TFUNC_A<w_a,w_b>( m_b1 ); // compiler trubbell
without the A:: it seems like it fails to parse.
side notes:
Apparently MSVC++ 7.0 and Borland compiles it fine
confirmed by Rob Williscroft on news:comp.lang.c++
MSVC++ 6.0sp5 dumps an internal compiler error.
On the code below GCC 3.2.1 gives the following message:
g++ tt2.cpp -o tt2
tt2.cpp: In member function `void Zoo::B::TFUNC_B(Zoo::A*) [with
Zoo::A*Zoo::A::*w_a = &Zoo::A::m_mem1, Zoo::A*Zoo::B::*w_b =
&Zoo::B::m_b1]':
tt2.cpp:68: instantiated from here
tt2.cpp:54: invalid use of member (did you forget the `&' ?)
tt2.cpp:54: comparison between distinct pointer types `Zoo::A*Zoo::B::*' and `
Zoo::A*' lacks a cast
make: *** [tt2] Error 1
class Zoo
{
public:
class B;
class A
{
public:
A * m_mem1;
A * m_mem2;
template <
A * A::* w_a,
A * B::* w_b
>
void TFUNC_A( A * i_1 )
{
i_1->*w_a = i_1;
}
typedef void ( A::* F_TA )( A * i_1 );
};
class B
{
public:
A * m_b1;
A * m_b2;
typedef void ( B::* F_TB )( A * i_1 );
template <
A * A::* w_a,
A * B::* w_b
>
void TFUNC_B( A * i_1 )
{
static const A::F_TA gg = ( & A::TFUNC_A<w_a,w_b> );
( i_1->*gg )( m_b1 );
i_1->A::TFUNC_A<w_a,w_b>( m_b1 );
i_1->TFUNC_A<w_a,w_b>( m_b1 ); // compiler trubbel
}
void Fooey( A * i_1 )
{
// static A * A::* const l_mem1 = &A::m_mem1;
// static A * B::* const l_b1 = &B::m_b1;
// this->TFUNC_B< l_mem1, l_b1 >( i_1 );
// static const F_TB gg = &B::TFUNC_B< l_mem1, l_b1 >;
// static const F_TB gg = &B::TFUNC_B< (&A::m_mem1), (&B::m_b1) >;
// (this->*gg)( i_1 );
this->TFUNC_B< &A::m_mem1, &B::m_b1 >( i_1 );
}
};
};
int main()
{
Zoo::A a[1];
Zoo::B b[1];
b->Fooey( a );
return 0;
}
>How-To-Repeat:
compile code in description
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-05-16 1:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-16 1:22 c++/10514: incorrect parsing of template instatiation with pointer-to-member variables giovannibajo
-- strict thread matches above, loose matches on Subject: below --
2003-04-28 13:56 reichelt
2003-04-27 15:36 gianni
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).