This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH, committed] Fix PR9030 (main trunk version)
- From: Kriang Lerdsuwanakij <lerdsuwa at users dot sourceforge dot net>
- To: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 09 Jan 2003 20:26:26 +0700
- Subject: Re: [C++ PATCH, committed] Fix PR9030 (main trunk version)
- References: <Pine.LNX.4.44.0301081013060.6643-100000@gandalf.ticam.utexas.edu>
Hi
I will fix the first testcase you listed. There was some oversight
in my code and I have already got a fix. Just need some more testing.
For the second and third testcases, they are parser bugs. The function
'cp_parser_elaborated_type_specifier' in the parser calls
'make_typename_type' with some invalid arguments.
Mark:
Would you look the testcase #2 and #3? I haven't yet figure out
lots of details in the parser to deal with this bug. Both case
'cp_parser_elaborated_type_specifier' calls 'make_typename_type'
using information 'parser->scope' that is broken.
For testcase #2, parser->scope is a non-template class (the
TEMPLATE_INFO is missing).
For testcase #3, parser->scope is NULL_TREE.
Best regards,
--Kriang
Wolfgang Bangerth wrote
thanks for your hard work on this, but I have to push you a little further
still: if one slightly modifies the testcase to this here
--------------------------------
template <class T> class O {
struct I { I (int); };
template <class T_>
friend typename O<T_>::I f ();;
};
template <class T_>
typename O<T_>::I f () { return 1; };
struct X {
void g() { f<int>(); }
};
--------------------------------
then this is still rejected:
g.cc: In function `typename O::I f()':
g.cc:2: error: `struct O<int>::I' is private
g.cc:9: error: within this context
That is, the original regression I have in my code is not yet gone. There
is something rather weird going on here, since if I make function g()
global, rather than put it into struct X, then the code compiles. I have
absolutely no idea whatsoever how this can happen :-(
Thanks for all your work
Wolfgang
PS: There are some nice variations of this code that trigger unexpected
behavior:
-------------------------------
class O {
struct I { I (int); };
template <class T_>
friend typename O::I f ();;
};
template <class T_>
typename O::I f () { return 1; };
struct X {
void g() { f<int>(); }
};
-------------------------------
yields
g.cc:2: error: `struct O::I' is private
g.cc:9: error: within this context
g.cc:2: error: `struct O::I' is private
g.cc:9: error: within this context
If I remove the spurious "typename" from O::I, the code compiles fine.
Oops.
Replacing the definition of f() by
-----------------------------
template <class T_>
typename O<T_>::I f () { return 1; };
-----------------------------
triggers an ICE. Double-oops. I'll file this as a separate report shortly.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ticam.utexas.edu
www: http://www.ticam.utexas.edu/~bangerth/