diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4d6476adacf..37ed5de5995 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,24 @@ +Mon Feb 2 11:24:22 1998 Mark Mitchell + + * cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): New macro. + (revert_static_member_fn): Declare. + * decl.c (revert_static_member_fn): Remove declaration. Change + linkage from internal to external. + (cp_finish_decl): Deal with virtual functions in classes local to + template functions. + * decl2.c (finish_file): Don't forget to emit increment/decrement + expressions in initializers for file-scope variables. + * parse.y (typename_sub2): If the typename doesn't names a + template, rather than a type, issue an error message. + * pt.c (check_explicit_specialization): Handle specializations of + static member functions. + (coerce_template_parms): Handle offset references to lists of + member functions. + * search.c (note_debug_info_needed): Don't crash when handed a + type which is being defined. + * typeck.c (complete_type): Don't crash when handed NULL_TREE; + that can happen with some illegal code. + Mon Feb 2 00:57:38 1998 Kaveh R. Ghazi * call.c (user_harshness): Initialize `code' to 0. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 85225da7393..fc3bc18400f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1020,10 +1020,15 @@ struct lang_decl (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \ || TREE_CODE (NODE) == CONST_DECL) +/* Nonzero for FUNCTION_DECL means that this decl is a non-static + member function. */ +#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \ + (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE) + /* Nonzero for FUNCTION_DECL means that this decl is a member function (static or non-static). */ #define DECL_FUNCTION_MEMBER_P(NODE) \ - (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE || DECL_STATIC_FUNCTION_P (NODE)) + (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE)) /* Nonzero for FUNCTION_DECL means that this member function has `this' as const X *const. */ @@ -2119,6 +2124,7 @@ extern int in_function_p PROTO((void)); extern void replace_defarg PROTO((tree, tree)); extern void print_other_binding_stack PROTO((struct binding_level *)); extern tree strip_attrs PROTO((tree)); +extern void revert_static_member_fn PROTO((tree*, tree*, tree*)); /* in decl2.c */ extern int flag_assume_nonnull_objects; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 27e4b31c08b..bf7fa02d75d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -136,7 +136,6 @@ static struct stack_level *decl_stack; static tree grokparms PROTO((tree, int)); static tree lookup_nested_type PROTO((tree, tree)); static char *redeclaration_error_message PROTO((tree, tree)); -static void revert_static_member_fn PROTO((tree *, tree *, tree *)); static tree push_overloaded_decl PROTO((tree, int)); static void push_overloaded_decl_top_level PROTO((tree, int)); @@ -6484,8 +6483,10 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) { tree stmt = DECL_VINDEX (decl); /* If the decl is declaring a member of a local class (in a - template function), there will be no associated stmt. */ - if (stmt != NULL_TREE) + template function), the DECL_VINDEX will either be NULL, + or it will be an actual virtual function index, not a + DECL_STMT. */ + if (stmt != NULL_TREE && TREE_CODE (stmt) == DECL_STMT) { DECL_VINDEX (decl) = NULL_TREE; TREE_OPERAND (stmt, 2) = copy_to_permanent (init); @@ -12997,7 +12998,7 @@ finish_stmt () (TREE_TYPE (decl)) to ARGTYPES, as doing so will corrupt the types of other decls. Either pass the addresses of local variables or NULL. */ -static void +void revert_static_member_fn (decl, fn, argtypes) tree *decl, *fn, *argtypes; { diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 1409c2fd321..a7eb19bfd20 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3140,6 +3140,10 @@ finish_file () } else expand_assignment (decl, init, 0, 0); + + /* The expression might have involved increments and + decrements. */ + emit_queue (); /* Cleanup any temporaries needed for the initial value. */ expand_end_target_temps (); diff --git a/gcc/cp/g++FAQ.texi b/gcc/cp/g++FAQ.texi index 7ea79d72841..b01a9ea92d0 100644 --- a/gcc/cp/g++FAQ.texi +++ b/gcc/cp/g++FAQ.texi @@ -3,7 +3,7 @@ @setfilename g++FAQ.info @settitle Frequently asked questions about the GNU C++ compiler @setchapternewpage off -@c version: @(#)g++FAQ.texi 1.57 12/14/97 +@c version: @(#)g++FAQ.texi 1.60 01/31/98 @c %**end of header @iftex @@ -12,7 +12,7 @@ @titlepage @title G++ FAQ @subtitle Frequently asked questions about the GNU C++ compiler -@subtitle December 14, 1997 +@subtitle January 31, 1998 @sp 1 @author Joe Buck @page @@ -35,8 +35,9 @@ all those who sent suggestions for improvements. Thanks to Marcus Speh for doing the index. A hypertext version is available on the World Wide Web at @file{http://www.cygnus.com/misc/g++FAQ_toc.html}. -@strong{News flash}: egcs has been released, and the 2.8.0 release is -expected very soon! +@strong{News flash}: gcc 2.8.0 has finally been released! +This FAQ still has much material that refers to older releases; it will +take some time before it is completely "modernized". Please send updates and corrections to the FAQ to @code{jbuck@@synopsys.com}. Please do @emph{not} use me as a resource @@ -62,85 +63,88 @@ You can find this FAQ at or in HTML form at @file{http://www.cerfnet.com/~mpcline/On-Line-C++-FAQs/}. @menu -* basics:: What is g++? How do I get it? -* egcs and 2.8.0:: The next generation(s) of g++ -* installation:: How to install, installation problems -* evolution:: The Evolution of g++ -* User Problems:: Commonly reported problems and bugs -* legalities:: Lawyer stuff, GPL, LGPL, etc. -* index:: Index of terms +* basics:: What is g++? How do I get it? +* egcs and 2.8.0:: The next generation(s) of g++ +* installation:: How to install, installation problems +* evolution:: The Evolution of g++ +* User Problems:: Commonly reported problems and bugs +* legalities:: Lawyer stuff, GPL, LGPL, etc. +* index:: Index of terms --- The Detailed Node Listing --- The basics: what is g++? -* latest versions:: -* g++ for Unix:: -* g++ for HP:: -* g++ for Solaris 2.x:: -* g++ for other platforms:: -* 1.x vs 2.x versions:: +* latest versions:: +* g++ for Unix:: +* g++ for HP:: +* g++ for Solaris 2.x:: +* g++ for other platforms:: +* 1.x vs 2.x versions:: The Next Generation(s) of g++ -* egcs-intro:: What is egcs? -* egcs-whats-new:: What's new in egcs vs 2.7.2? -* egcs-run-both:: How can I run both egcs and an FSF release? -* egcs-vs-2.8.0:: How will egcs affect 2.8.0? -* egcs-robustness:: How robust is egcs-1.0? +* new-in-2.8.0:: What's new in gcc 2.8.0? +* egcs-intro:: What is egcs? +* egcs-whats-new:: What's new in egcs vs 2.7.2? +* egcs-bug-fixes:: What was fixed in egcs-1.0.1? +* egcs-linux:: If I install on Linux, will it overwrite my libraries? +* egcs-run-both:: How can I run both egcs and an FSF release? +* egcs-vs-2.8.0:: How will egcs affect 2.8.0? +* egcs-robustness:: How robust is egcs? Installation Issues and Problems -* gcc-2 + g++-1:: -* what else do I need?:: -* use GNU linker?:: -* Use GNU assembler?:: -* shared libraries:: -* repository:: -* repo bugs:: -* Use GNU C library?:: +* gcc-2 + g++-1:: +* what else do I need?:: +* use GNU linker?:: +* Use GNU assembler?:: +* shared libraries:: +* repository:: +* repo bugs:: +* Use GNU C library?:: * Global constructor problems:: -* Strange assembler errors:: +* Strange assembler errors:: * Other problems building libg++:: -* More size_t problems:: -* Rebuild libg++?:: -* co-existing versions:: -* Installing on Linux:: -* Linux Slackware 3.0:: +* More size_t problems:: +* Rebuild libg++?:: +* co-existing versions:: +* Installing on Linux:: +* Linux Slackware 3.0:: The Evolution of g++ -* version 2.7.x:: What's changed in 2.7.x from earlier versions -* libstdc++:: +* version 2.7.x:: What's changed in 2.7.x from earlier versions +* libstdc++:: User Problems -* missing virtual table:: -* for scope:: -* const constructor:: -* unused parameter warnings:: +* missing virtual table:: +* for scope:: +* const constructor:: +* unused parameter warnings:: * jump crosses initialization:: -* Demangler:: -* static data members:: -* internal compiler error:: -* bug reports:: -* porting to g++:: -* name mangling:: +* Demangler:: +* static data members:: +* internal compiler error:: +* bug reports:: +* porting to g++:: +* name mangling:: * problems linking with other libraries:: -* documentation:: -* templates:: -* undefined templates:: -* redundant templates:: -* Standard Template Library:: -* STL and string:: -* exceptions:: -* namespaces:: -* agreement with standards:: +* documentation:: +* templates:: +* undefined templates:: +* redundant templates:: +* Standard Template Library:: +* STL and string:: +* exceptions:: +* namespaces:: +* agreement with standards:: * compiling standard libraries:: -* debugging on SVR4 systems:: +* debugging on SVR4 systems:: * debugging problems on Solaris:: -* X11 conflicts with libg++:: -* assignment to streams:: +* X11 conflicts with libg++:: +* assignment to streams:: @end menu @node basics, egcs and 2.8.0, Top, Top @@ -161,12 +165,12 @@ it is not public domain, but is protected by the GNU Public License, or GPL (@pxref{legalities}). @menu -* latest versions:: -* g++ for Unix:: -* g++ for HP:: -* g++ for Solaris 2.x:: -* g++ for other platforms:: -* 1.x vs 2.x versions:: +* latest versions:: +* g++ for Unix:: +* g++ for HP:: +* g++ for Solaris 2.x:: +* g++ for other platforms:: +* 1.x vs 2.x versions:: @end menu @node latest versions, g++ for Unix, basics, basics @@ -175,20 +179,23 @@ or GPL (@pxref{legalities}). @cindex egcs release The egcs project (on the Web: @file{http://www.cygnus.com/egcs/}) has -now released egcs-1.0 as of December 3, 1997. +released a bug-fix version, egcs-1.0.1, on January 6, 1998. Folks +using egcs-1.0 should upgrade, as it has some important bug fixes. @cindex gcc/g++, version date -The current version of gcc/g++ is 2.7.2.3, released August 20, 1997. -Although that looks very recent, the only change is a minor patch to -resolve a problem with Linux and the GNU C library; users not interested -in that functionality have no reason to upgrade. +The current version of gcc/g++ is 2.8.0 (!), released January 14, 1998. +It is a huge improvement over the 2.7.x releases, and thanks to +extensive testing in the egcs framework, is perhaps the least buggy .0 +gcc release anyone can remember (though there are definitely a few). -The current version of libg++ is 2.7.2, released July 4, 1996. -The last release of gcc/g++ with improvements to the C++ front end was -2.7.2, released Nov. 25, 1995, nearly two years ago. +The current version of libg++ is 2.8.0, released January 19, 1998. +However, libg++ is being deprecated; libstdc++-2.8.0 contains just the +standard C++ classes and is a subset of libg++ 2.8.0. The libstdc++ +library is identical to the one included in egcs-1.0.1. I would strongly recommend that anyone using a g++ version earlier than 2.7.2 should upgrade if at all possible (@pxref{version 2.7.x}). +Folks who need modern C++ features should upgrade to 2.8.0 or egcs. For some non-Unix platforms, the latest port of gcc may be an earlier version (2.6.3, say). You'll need to use a version of libg++ that @@ -411,7 +418,7 @@ places Eberhard Mattes did the EMX port. His address is mattes@@azu.informatik.uni-stuttgart.de. -Read the FAQ file included with the distribution before harassing the author. +Read the FAQ file included with the distribution before harrassing the author. @cindex Apple support @cindex Macintosh support @@ -432,7 +439,7 @@ him directly (shebs@@cygnus.com) for more information. @node 1.x vs 2.x versions, , g++ for other platforms, basics @section But I can only find g++-1.42! -``I keep hearing people talking about g++ 2.7.2 (or some other number +``I keep hearing people talking about g++ 2.8.0 (or some other number starting with 2), but the latest version I can find is g++ 1.42. Where is it?'' @@ -450,14 +457,39 @@ convention. It means ``the C++ compiler included with gcc-2.x.y.'' @chapter The Next Generation(s) of g++ @menu -* egcs-intro:: What is egcs? -* egcs-whats-new:: What's new in egcs vs 2.7.2? -* egcs-run-both:: How can I run both egcs and an FSF release? -* egcs-vs-2.8.0:: How will egcs affect 2.8.0? -* egcs-robustness:: How robust is egcs-1.0? +* new-in-2.8.0:: What's new in gcc 2.8.0? +* egcs-intro:: What is egcs? +* egcs-whats-new:: What's new in egcs vs 2.7.2? +* egcs-bug-fixes:: What was fixed in egcs-1.0.1? +* egcs-linux:: If I install on Linux, will it overwrite my libraries? +* egcs-run-both:: How can I run both egcs and an FSF release? +* egcs-vs-2.8.0:: How will egcs affect 2.8.0? +* egcs-robustness:: How robust is egcs? @end menu -@node egcs-intro, egcs-whats-new, egcs and 2.8.0, egcs and 2.8.0 +@node new-in-2.8.0, egcs-intro, egcs and 2.8.0, egcs and 2.8.0 +@section What's new in gcc/g++ 2.8.0? + +After a two-year wait, gcc 2.8.0 was released in January 1998, along +with libstdc++-2.8.0 and libg++-2.8.0. Note that the latter (libg++) +contains the former (libstdc++) so there is no reason to install both +library packages, but libstdc++ is required. + +For those familiar with egcs, the most obvious difference between +gcc-2.8.0 and egcs-1.0 or 1.0.1 is the packaging: egcs is bundled with +libstdc++, and gcc-2.8.0 does not contain the class library. Otherwise, +except for the lack of the @code{-frepo} option and some bug fixes +that have not yet made it into gcc-2.8.0, C++ users will find the +two compilers to be almost the same at this stage, other than that 2.8.0 +users may get more bogus warnings with -Wall and optimization because +some fixes to flow analysis in the presence of exceptions that egcs made +are not yet present in gcc 2.8.0. + +Because the new feature lists for egcs and gcc 2.8 are almost the same, +please see @xref{egcs-whats-new} for a list of new features. It is a +fairly long list. + +@node egcs-intro, egcs-whats-new, new-in-2.8.0, egcs and 2.8.0 @section What is egcs? egcs is the Experimental GNU compiler system (see @@ -466,35 +498,39 @@ accelerate development of new gcc features by providing a more open development model than gcc has traditionally used. The first egcs release, egcs-1.0, came out on December 3, 1997. +The current release is egcs-1.0.1, released January 6, 1998. Questions not addressed here may be answered in the egcs FAQ (@file{http://www.cygnus.com/egcs/faq.html}). -@node egcs-whats-new, egcs-run-both, egcs-intro, egcs and 2.8.0 +@node egcs-whats-new, egcs-bug-fixes, egcs-intro, egcs and 2.8.0 @section What new C++ features are in egcs? -@strong{Note}: unless indicated otherwise, these features are expected -to be present in g++ 2.8.0 when released. +@strong{Note}: unless indicated otherwise, these features are also +present in g++ 2.8.0. @itemize @bullet @item @cindex integrated libstdc++ -The standard C++ classes are integrated with the egcs release (this is -@emph{not} expected to be true of gcc-2.8.0). libg++ is not being -supported, though a version that will work with egcs has been -contributed (FIXME: pointer?). The compiler and library are configured -and built in one step. +The standard C++ classes are integrated with the egcs release (but +@strong{not} for gcc-2.8.0, which does not include the class libraries). +libg++ is not being +supported, though an add-on version that will work with egcs can be found at +@file{ftp://ftp.yggdrasil.com/private/hjl/libg++-2.8.0b6.6.tar.gz}, +thanks to H.J. Lu. The compiler and library are configured and built +in one step. @item @cindex new template implementation A completely new template implementation, much closer to the draft standard. Limitations in 2.7.2.x concerning inlining template functions -will be eliminated. Static template data members, template class member -functions, partial specification, and default template arguments will be +are eliminated. Static template data members, template class member +functions, partial specification, and default template arguments are supported. An instantiation method resembling that used in Borland C++ (instantiating functions possibly in multiple .o files and using weak symbols to link correctly) is provided, in addition to other -options. The SGI version of STL is shipped verbatim with libstdc++. +options. The SGI version of STL is shipped verbatim with libstdc++ +(libstdc++ is included with egcs, separate with gcc-2.8.0). @item @cindex redundant template elimination @@ -506,9 +542,9 @@ at link time. @item @cindex repository @cindex -frepo -The @code{-frepo} flag is supported in egcs (it will not be in 2.8.0). +The @code{-frepo} flag is supported in egcs (it is not in 2.8.0). However, because of the previous item, I don't recommend its use on ELF -systems. +systems, as the default method is better. @item @cindex new exception implementation @@ -536,7 +572,54 @@ There are many more changes: see @file{http://www.cygnus.com/egcs/c++features.ht Features that are still missing include namespaces and templates as template arguments. -@node egcs-run-both, egcs-vs-2.8.0, egcs-whats-new, egcs and 2.8.0 +@node egcs-bug-fixes, egcs-linux, egcs-whats-new, egcs and 2.8.0 +@section What was fixed in egcs-1.0.1? + +@itemize @bullet + +@item +Add support for Red Hat 5.0 Linux and better support for Linux +systems using glibc2. + +@item +Compatibility with both egcs-1.0 and gcc-2.8 libgcc exception handling +interfaces (see below). + +@item +Various bugfixes in the x86, hppa, mips, and rs6000/ppc backends. + +@item +A few machine independent bugfixes, mostly to fix code generation bugs +when building Linux kernels or glibc. + +@item +Fix a few critical exception handling and template bugs in the C++ +compiler. + +@item +Fix build problems on x86-solaris systems. +@end itemize + +To avoid future compatibility problems, we strongly urge anyone who is +planning on distributing shared libraries that contain C++ code to +upgrade to egcs-1.0.1 first. See +@file{http://www.cygnus.com/egcs/egcs-1.0.1.html} for details about the +compatibility issues as well as additional information about the +bugfixes since the egcs-1.0 release. + +@node egcs-linux, egcs-run-both, egcs-bug-fixes, egcs and 2.8.0 +@section If I install egcs on Linux, will it overwrite my libraries? + +No. If you build from sources, by default, egcs installs executables in +@code{/usr/local/bin} and libraries in @code{/usr/local/lib}, and you +can change this default if desired (see next section). + +If, however, you install a package (e.g. Debian or Red Hat) that wants +to put egcs in @code{/usr/bin} and @code{/usr/lib}, then yes, you are +replacing your system compiler and C++ library (I don't know if anyone +has provided such packages yet -- proceed with caution). + +@node egcs-run-both, egcs-vs-2.8.0, egcs-linux, egcs and 2.8.0 @section How can I run both egcs and an FSF release of g++ on the same machine? The recommended approach is to provide a different argument to the @@ -553,56 +636,45 @@ ln -s /usr/local/egcs/bin/g++ /usr/local/bin/eg++ @node egcs-vs-2.8.0, egcs-robustness, egcs-run-both, egcs and 2.8.0 @section What about 2.8.0? How does egcs affect the 2.8.x development? -2.8.0 is expected Real Soon Now (I would guess by the end of 1997, but that -is only a guess). The C++ front end should be essentially the same. +2.8.0 has now been released, with essentially the same C++ front end as +egcs. Bug fixes generated in egcs will be passed to the 2.8.x releases for inclusion; the reverse is also taking place, though a bug fix may -appear in one before it does in the other. +appear in one before it does in the other. egcs development is expected +to proceed more quickly. @node egcs-robustness, , egcs-vs-2.8.0, egcs and 2.8.0 -@section How solid is egcs-1.0? +@section How robust is egcs? While the 'e' stands for 'experimental', egcs has been tested thoroughly -and should be of high quality. There are a few glitches which should be -fixed shortly (in a 1.0.1 release, probably in early January): +and should be of high quality. A few glitches in the initial release +were fixed in 1.0.1. egcs-1.0 users should upgrade. -@itemize @bullet -@item -Deeply nested templates sometimes lead to a very large memory requirement -if the @code{-Wreturn-type} option is on (note: this flag is implicitly -turned on by @code{-W} or @code{-Wall}. A workaround is to give the -flag @code{-Wno-return-type} if you use @code{-Wall}. - -@item -On Red Hat 5.0, it may be necessary to link all C++ programs with -@code{-lpthread} to work around an undefined symbol problem. - -@item -A patch is needed to fix egcs on Solaris/X86. It is in the egcs FAQ -(see above). -@end itemize +Some memory bloat problems with deeply nested templates were fixed in +1.0.1 (though it appears that there are still a few cases where +excessive memory requirements occur). @node installation, evolution, egcs and 2.8.0, Top @chapter Installation Issues and Problems @menu -* gcc-2 + g++-1:: -* what else do I need?:: -* use GNU linker?:: -* Use GNU assembler?:: -* shared libraries:: -* repository:: -* repo bugs:: -* Use GNU C library?:: +* gcc-2 + g++-1:: +* what else do I need?:: +* use GNU linker?:: +* Use GNU assembler?:: +* shared libraries:: +* repository:: +* repo bugs:: +* Use GNU C library?:: * Global constructor problems:: -* Strange assembler errors:: +* Strange assembler errors:: * Other problems building libg++:: -* More size_t problems:: -* Rebuild libg++?:: -* co-existing versions:: -* Installing on Linux:: -* Linux Slackware 3.0:: +* More size_t problems:: +* Rebuild libg++?:: +* co-existing versions:: +* Installing on Linux:: +* Linux Slackware 3.0:: @end menu @node gcc-2 + g++-1, what else do I need?, installation, installation @@ -701,7 +773,7 @@ debug format (e.g. Suns running SunOS 4.x), the GNU linker compresses the debug symbol table considerably. The 2.7 version adds some symbol table compression for ELF and Solaris targets. -Users of egcs or 2.8.0 (when released) on ELF systems should definitely +Users of egcs or 2.8.0 on ELF systems should definitely use GNU ld (2.8 or later), as it will automatically remove duplicate instantiations of templates, virtual function tables, or ``outlined'' copies of inline functions. @@ -1102,19 +1174,20 @@ This chapter discusses the evolution of g++ and describes what can be expected in the future. @menu -* version 2.7.x:: What's changed in 2.7.x from earlier versions -* libstdc++:: +* version 2.7.x:: What's changed in 2.7.x from earlier versions +* libstdc++:: @end menu @node version 2.7.x, libstdc++, evolution, evolution @section What's new in version 2.7.x of gcc/g++ -The current version of gcc/g++ is 2.7.2.2, released February 10, 1997. -The only change between 2.7.2.1 and 2.7.2.2 is that support was added -for using the GNU C library, version 2, on Linux; users not interested -in that functionality have no reason to upgrade. -The previous version of gcc/g++ is 2.7.2.1, released August 14, 1996. -The current version of libg++ is 2.7.2, released July 4, 1996. +[ This section is old now, since 2.8.0/egcs is the new stuff ] The +latest 2.7.x version was 2.7.2.2, released February 10, 1997. The only +change between 2.7.2.1 and 2.7.2.2 is that support was added for using +the GNU C library, version 2, on Linux; users not interested in that +functionality have no reason to upgrade. The previous version of +gcc/g++ was 2.7.2.1, released August 14, 1996. The libg++ version that +should be used with any 2.7.x gcc/g++ is 2.7.2, released July 4, 1996. Note that gcc 2.7.2.1 just consists of several small patches to gcc-2.7.2. The release is mainly @@ -1265,32 +1338,32 @@ will always be available, enhancements to it should not be expected. @chapter User Problems @menu -* missing virtual table:: -* for scope:: -* const constructor:: -* unused parameter warnings:: +* missing virtual table:: +* for scope:: +* const constructor:: +* unused parameter warnings:: * jump crosses initialization:: -* Demangler:: -* static data members:: -* internal compiler error:: -* bug reports:: -* porting to g++:: -* name mangling:: +* Demangler:: +* static data members:: +* internal compiler error:: +* bug reports:: +* porting to g++:: +* name mangling:: * problems linking with other libraries:: -* documentation:: -* templates:: -* undefined templates:: -* redundant templates:: -* Standard Template Library:: -* STL and string:: -* exceptions:: -* namespaces:: -* agreement with standards:: +* documentation:: +* templates:: +* undefined templates:: +* redundant templates:: +* Standard Template Library:: +* STL and string:: +* exceptions:: +* namespaces:: +* agreement with standards:: * compiling standard libraries:: -* debugging on SVR4 systems:: +* debugging on SVR4 systems:: * debugging problems on Solaris:: -* X11 conflicts with libg++:: -* assignment to streams:: +* X11 conflicts with libg++:: +* assignment to streams:: @end menu @node missing virtual table, for scope, User Problems, User Problems @@ -1711,7 +1784,7 @@ While there is no libg++-specific document describing the STL implementation, SGI's web site, at @file{http://www.sgi.com/Technology/STL/}, is an excellent resource. Note that the SGI version of STL is the one that is included with the -egcs and 2.8.0 (when it occurs) releases of g++. +egcs and 2.8.0 releases of g++/libstdc++. @end itemize @@ -1746,10 +1819,10 @@ template ostream& operator << (ostream&, const A&); @end example @cindex template limitations -As of version 2.6.3, there are still a few limitations in the template +As of version 2.7.2, there are still a few limitations in the template implementation besides the above (thanks to Jason Merrill for this info): -These are still present in version 2.7.2, but a new implementation of -templates planned for version 2.8 will eliminate them. + +@strong{Note}: these problems are eliminated in egcs and in gcc-2.8.0. @enumerate 1 @item @@ -1809,7 +1882,7 @@ void g () @{ @} @end example -A workaround that works in version 2.6.1 and later is to specify +A workaround that works in version 2.6.1 through 2.7.2.x is to specify @example extern template int min (int, int); @@ -1818,9 +1891,15 @@ extern template int min (int, int); before @code{f()}; this will force it to be instantiated (though not emitted). +@strong{Note:} this kind of ``guiding declaration'' is not standard and +isn't supported by egcs or gcc-2.8.0, as the standard says that this +declares a ``normal'' @code{min} function which has no relation to +the template function @code{min(int,int)}. But then the new +compilers have no problem inlining template functions. + @item Member function templates are always instantiated when their containing -class is. This is wrong. +class is. This is wrong (fixed in egcs/2.8). @end enumerate @node undefined templates, redundant templates, templates, User Problems @@ -1902,34 +1981,20 @@ This bug is fixed in 2.7.0. @node Standard Template Library, STL and string, redundant templates, User Problems @section Does g++ support the Standard Template Library? -@cindex STL -@cindex Standard Template Library -The Standard Template Library (STL) uses many of the extensions that the -ANSI/ISO committee has made to templates, and g++ doesn't support -some of these yet. So if you grab HP's free implementation of STL it -isn't going to work. However, starting with libg++-2.6.2 libg++ contains a -hacked version of STL, based on work by Carsten Bormann, which permits -g++ to compile at least the containers (thanks to Per Bothner for this -text). +If you want to use the Standard Template Library, do not pass go, +upgrade immediately to gcc-2.8.0 or to egcs. The new C++ front end +handles STL very well, and the high-quality implementation of STL +from SGI is included verbatim as part of the libstdc++ class library. -Actually, as of libg++ version 2.7.2 most of this works quite well, most -of the time; -I've succeeded -in making significant use of it. -Almost all of the ObjectSpace examples (a set of -over 200 simple examples of STL usage) now work. - -When version 2.8.0 is out (with its complete redesign of the template -implementation) a much more complete implementation of the -STL (based on a newer free implementation from SGI) will be included. -In the meantime, a group at the Moscow Center for Sparc Technology has +If for some reason you must use 2.7.2, you can probably get by with +the hacked-up version of the old implementation from HP that is +included with libg++-2.7.2, but it is definitely inferior and has more +problems. Alternatively, g++ 2.7.2.x users might try the following: +a group at the Moscow Center for Sparc Technology has a port of the SGI STL implementation that mostly works with gcc-2.7.2. See @file{http://www.ipmce.su/people/fbp/stl/stlport.html}. -In addition, there are several commercial suppliers of STL implementations; -ObjectSpace's version supports gcc-2.7.x. - Mumit Khan has produced an ``STL newbie guide'' with lots of information on using STL with gcc. See @@ -1938,6 +2003,8 @@ on using STL with gcc. See @node STL and string, exceptions, Standard Template Library, User Problems @section I'm having problems mixing STL and the standard string class +[ This section is for g++ 2.7.2.x users only ] + This is due to a bug in g++ version 2.7.2 and 2.7.2.1; the compiler is confused by the operator declarations. There is an easy workaround, however; just make sure that the @code{} header is included @@ -1981,29 +2048,34 @@ and ``VAX may also work'' (according to Mike Stump). As of version 2.7.2, g++ recognizes the keywords @code{namespace} and @code{using}, and there is some rudimentary code present, but almost -nothing connected with namespaces works yet. It appears that this will -still be true when 2.8.0 is released. +nothing connected with namespaces works yet. +The new versions (2.8.0/egcs) still lack namespace support, but to help +compile standard programs they make + +@example +using namespace std; +@end example + +a no-op. @node agreement with standards, compiling standard libraries, namespaces, User Problems @section What are the differences between g++ and the ARM specification of C++? @cindex ARM [Annotated C++ Ref Manual] @cindex exceptions -As of version 2.7.0, g++ has exception support on most but not all -platforms -(no support on MIPS-based platforms yet), but -it doesn't work right if optimization is enabled, which means the -exception -implementation is still -not really ready for production use. +Up until recently, there was no really usable exception support. If you +need exceptions, you want gcc-2.8.0 or egcs. The implementation works +fairly well. The 2.7.x version was strictly alpha quality and quite +fragile. @cindex mutable Some features that the ANSI/ISO standardization committee has voted in that don't appear in the ARM are supported, notably the @code{mutable} -keyword, in version 2.5.x. 2.6.x adds support for the built-in boolean -type @code{bool}, with constants @code{true} and @code{false}. The -beginnings of run-time type identification are present, so there are +keyword, in version 2.5.x. 2.6.x added support for the built-in boolean +type @code{bool}, with constants @code{true} and @code{false}. Run-time +type identification was rudimentary in 2.7.x but is fully supported in +2.8.0, so there are more reserved words: @code{typeid}, @code{static_cast}, @code{reinterpret_cast}, @code{const_cast}, and @code{dynamic_cast}. @@ -2011,6 +2083,7 @@ more reserved words: @code{typeid}, @code{static_cast}, As with any beta-test compiler, there are bugs. You can help improve the compiler by submitting detailed bug reports. +[ This paragraph obsoleted by 2.8.0/egcs: ] One of the weakest areas of g++ other than templates is the resolution of overloaded functions and operators in complex cases. The usual symptom is that in a case where the ARM says that it is ambiguous which @@ -2069,7 +2142,8 @@ debugging information in a format known as `DWARF'. Although the GNU C compiler already knows how to write out symbolic debugging information in the DWARF format, the GNU C++ compiler does not yet have this feature yet. However, work is in progress for DWARF 2 debug support for -gcc and g++ and will be available in a future release (probably 2.8.0). +gcc and g++ and it works fairly well in 2.8.0 and egcs, though we'll +have to wait for gdb 4.17 to be released to take full advantage. @cindex stabs @cindex --with-stabs @@ -2235,6 +2309,10 @@ all the standard classes are in @file{-lstdc++}; you can do the link step with @code{c++} instead of @code{g++} to search only the @file{-lstdc++} library and avoid the LGPL'ed code in @file{-lg++}. +Note that in egcs and in gcc-2.8.0, if you do not +specify any libraries the @code{g++} command will only link in +@file{-lstdc++}, so your executable will not be affected by the LGPL. + If you wish to discuss legal issues connected with GNU software on the net, please use @file{gnu.misc.discuss}, not the technical newsgroups. diff --git a/gcc/cp/parse.c b/gcc/cp/parse.c index c72cc082cba..7bc897d2647 100644 --- a/gcc/cp/parse.c +++ b/gcc/cp/parse.c @@ -675,30 +675,30 @@ static const short yyrline[] = { 0, 3126, 3130, 3133, 3136, 3138, 3140, 3142, 3146, 3149, 3152, 3154, 3156, 3158, 3165, 3176, 3180, 3185, 3189, 3194, 3196, 3200, 3203, 3205, 3209, 3211, 3212, 3215, 3217, 3223, 3238, - 3244, 3250, 3264, 3266, 3270, 3286, 3292, 3307, 3314, 3320, - 3322, 3323, 3324, 3332, 3341, 3342, 3346, 3349, 3355, 3361, - 3364, 3366, 3368, 3370, 3374, 3378, 3382, 3385, 3390, 3393, - 3395, 3397, 3399, 3401, 3403, 3405, 3407, 3411, 3415, 3419, - 3423, 3424, 3426, 3428, 3430, 3432, 3434, 3436, 3438, 3440, - 3448, 3450, 3451, 3452, 3455, 3463, 3468, 3475, 3477, 3482, - 3484, 3487, 3501, 3504, 3507, 3516, 3528, 3539, 3559, 3569, - 3572, 3580, 3592, 3595, 3598, 3601, 3617, 3620, 3631, 3632, - 3636, 3651, 3670, 3682, 3696, 3710, 3723, 3742, 3760, 3779, - 3787, 3808, 3826, 3839, 3840, 3843, 3843, 3846, 3846, 3849, - 3849, 3855, 3861, 3864, 3869, 3876, 3885, 3894, 3903, 3911, - 3924, 3926, 3930, 3932, 3935, 3942, 3945, 3953, 3969, 3980, - 3992, 3994, 3997, 4007, 4017, 4028, 4030, 4032, 4035, 4052, - 4058, 4066, 4068, 4070, 4074, 4077, 4078, 4086, 4090, 4094, - 4097, 4098, 4104, 4107, 4110, 4112, 4116, 4121, 4124, 4134, - 4139, 4140, 4148, 4154, 4159, 4163, 4168, 4172, 4176, 4180, - 4185, 4196, 4210, 4214, 4217, 4219, 4223, 4227, 4230, 4233, - 4235, 4239, 4241, 4248, 4255, 4258, 4261, 4265, 4269, 4275, - 4279, 4284, 4286, 4289, 4294, 4300, 4311, 4314, 4316, 4320, - 4325, 4327, 4334, 4337, 4339, 4341, 4347, 4352, 4355, 4357, - 4359, 4361, 4363, 4365, 4367, 4369, 4371, 4373, 4375, 4377, - 4379, 4381, 4383, 4385, 4387, 4389, 4391, 4393, 4395, 4397, - 4399, 4401, 4403, 4405, 4407, 4409, 4411, 4413, 4415, 4417, - 4420, 4422 + 3244, 3250, 3264, 3266, 3270, 3286, 3292, 3307, 3318, 3324, + 3326, 3327, 3328, 3336, 3345, 3346, 3350, 3353, 3359, 3365, + 3368, 3370, 3372, 3374, 3378, 3382, 3386, 3389, 3394, 3397, + 3399, 3401, 3403, 3405, 3407, 3409, 3411, 3415, 3419, 3423, + 3427, 3428, 3430, 3432, 3434, 3436, 3438, 3440, 3442, 3444, + 3452, 3454, 3455, 3456, 3459, 3467, 3472, 3479, 3481, 3486, + 3488, 3491, 3505, 3508, 3511, 3520, 3532, 3543, 3563, 3573, + 3576, 3584, 3596, 3599, 3602, 3605, 3621, 3624, 3635, 3636, + 3640, 3655, 3674, 3686, 3700, 3714, 3727, 3746, 3764, 3783, + 3791, 3812, 3830, 3843, 3844, 3847, 3847, 3850, 3850, 3853, + 3853, 3859, 3865, 3868, 3873, 3880, 3889, 3898, 3907, 3915, + 3928, 3930, 3934, 3936, 3939, 3946, 3949, 3957, 3973, 3984, + 3996, 3998, 4001, 4011, 4021, 4032, 4034, 4036, 4039, 4056, + 4062, 4070, 4072, 4074, 4078, 4081, 4082, 4090, 4094, 4098, + 4101, 4102, 4108, 4111, 4114, 4116, 4120, 4125, 4128, 4138, + 4143, 4144, 4152, 4158, 4163, 4167, 4172, 4176, 4180, 4184, + 4189, 4200, 4214, 4218, 4221, 4223, 4227, 4231, 4234, 4237, + 4239, 4243, 4245, 4252, 4259, 4262, 4265, 4269, 4273, 4279, + 4283, 4288, 4290, 4293, 4298, 4304, 4315, 4318, 4320, 4324, + 4329, 4331, 4338, 4341, 4343, 4345, 4351, 4356, 4359, 4361, + 4363, 4365, 4367, 4369, 4371, 4373, 4375, 4377, 4379, 4381, + 4383, 4385, 4387, 4389, 4391, 4393, 4395, 4397, 4399, 4401, + 4403, 4405, 4407, 4409, 4411, 4413, 4415, 4417, 4419, 4421, + 4424, 4426 }; #endif @@ -7213,12 +7213,16 @@ case 618: #line 3309 "parse.y" { if (TREE_CODE (yyvsp[-1].ttype) != IDENTIFIER_NODE) - yyval.ttype = lastiddecl; - got_scope = yyval.ttype = complete_type (TREE_TYPE (yyval.ttype)); + yyvsp[-1].ttype = lastiddecl; + + got_scope = yyval.ttype = complete_type (TREE_TYPE (yyvsp[-1].ttype)); + + if (yyval.ttype == error_mark_node) + cp_error ("`%T' is not a class or namespace", yyvsp[-1].ttype); ; break;} case 619: -#line 3315 "parse.y" +#line 3319 "parse.y" { if (TREE_CODE (yyvsp[-1].ttype) != IDENTIFIER_NODE) yyval.ttype = lastiddecl; @@ -7226,11 +7230,11 @@ case 619: ; break;} case 620: -#line 3321 "parse.y" +#line 3325 "parse.y" { got_scope = yyval.ttype = complete_type (TREE_TYPE (yyval.ttype)); ; break;} case 623: -#line 3325 "parse.y" +#line 3329 "parse.y" { if (TREE_CODE (yyval.ttype) == IDENTIFIER_NODE) yyval.ttype = lastiddecl; @@ -7238,7 +7242,7 @@ case 623: ; break;} case 624: -#line 3334 "parse.y" +#line 3338 "parse.y" { if (TREE_CODE (yyvsp[0].ttype) == IDENTIFIER_NODE) yyval.ttype = IDENTIFIER_GLOBAL_VALUE (yyvsp[0].ttype); @@ -7248,156 +7252,156 @@ case 624: ; break;} case 626: -#line 3343 "parse.y" +#line 3347 "parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 627: -#line 3348 "parse.y" +#line 3352 "parse.y" { got_scope = NULL_TREE; ; break;} case 628: -#line 3350 "parse.y" +#line 3354 "parse.y" { yyval.ttype = yyvsp[-1].ttype; got_scope = NULL_TREE; ; break;} case 629: -#line 3357 "parse.y" +#line 3361 "parse.y" { got_scope = void_type_node; ; break;} case 630: -#line 3363 "parse.y" +#line 3367 "parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 631: -#line 3365 "parse.y" +#line 3369 "parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[0].ttype, NULL_TREE); ; break;} case 632: -#line 3367 "parse.y" +#line 3371 "parse.y" { yyval.ttype = make_reference_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 633: -#line 3369 "parse.y" +#line 3373 "parse.y" { yyval.ttype = make_reference_declarator (yyvsp[0].ttype, NULL_TREE); ; break;} case 634: -#line 3371 "parse.y" +#line 3375 "parse.y" { tree arg = make_pointer_declarator (yyvsp[0].ttype, NULL_TREE); yyval.ttype = build_parse_node (SCOPE_REF, yyvsp[-1].ttype, arg); ; break;} case 635: -#line 3375 "parse.y" +#line 3379 "parse.y" { tree arg = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); yyval.ttype = build_parse_node (SCOPE_REF, yyvsp[-2].ttype, arg); ; break;} case 637: -#line 3384 "parse.y" +#line 3388 "parse.y" { yyval.ttype = build_parse_node (ARRAY_REF, NULL_TREE, yyvsp[-1].ttype); ; break;} case 638: -#line 3386 "parse.y" +#line 3390 "parse.y" { yyval.ttype = build_parse_node (ARRAY_REF, yyval.ttype, yyvsp[-1].ttype); ; break;} case 639: -#line 3392 "parse.y" +#line 3396 "parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ftype.t, yyvsp[0].ttype); ; break;} case 640: -#line 3394 "parse.y" +#line 3398 "parse.y" { yyval.ttype = make_pointer_declarator (NULL_TREE, yyvsp[0].ttype); ; break;} case 641: -#line 3396 "parse.y" +#line 3400 "parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[0].ftype.t, NULL_TREE); ; break;} case 642: -#line 3398 "parse.y" +#line 3402 "parse.y" { yyval.ttype = make_pointer_declarator (NULL_TREE, NULL_TREE); ; break;} case 643: -#line 3400 "parse.y" +#line 3404 "parse.y" { yyval.ttype = make_reference_declarator (yyvsp[-1].ftype.t, yyvsp[0].ttype); ; break;} case 644: -#line 3402 "parse.y" +#line 3406 "parse.y" { yyval.ttype = make_reference_declarator (NULL_TREE, yyvsp[0].ttype); ; break;} case 645: -#line 3404 "parse.y" +#line 3408 "parse.y" { yyval.ttype = make_reference_declarator (yyvsp[0].ftype.t, NULL_TREE); ; break;} case 646: -#line 3406 "parse.y" +#line 3410 "parse.y" { yyval.ttype = make_reference_declarator (NULL_TREE, NULL_TREE); ; break;} case 647: -#line 3408 "parse.y" +#line 3412 "parse.y" { tree arg = make_pointer_declarator (yyvsp[0].ttype, NULL_TREE); yyval.ttype = build_parse_node (SCOPE_REF, yyvsp[-1].ttype, arg); ; break;} case 648: -#line 3412 "parse.y" +#line 3416 "parse.y" { tree arg = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); yyval.ttype = build_parse_node (SCOPE_REF, yyvsp[-2].ttype, arg); ; break;} case 650: -#line 3421 "parse.y" +#line 3425 "parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} case 652: -#line 3425 "parse.y" +#line 3429 "parse.y" { yyval.ttype = make_call_declarator (yyval.ttype, yyvsp[-3].ttype, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 653: -#line 3427 "parse.y" +#line 3431 "parse.y" { yyval.ttype = make_call_declarator (yyval.ttype, empty_parms (), yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 654: -#line 3429 "parse.y" +#line 3433 "parse.y" { yyval.ttype = build_parse_node (ARRAY_REF, yyval.ttype, yyvsp[-1].ttype); ; break;} case 655: -#line 3431 "parse.y" +#line 3435 "parse.y" { yyval.ttype = build_parse_node (ARRAY_REF, yyval.ttype, NULL_TREE); ; break;} case 656: -#line 3433 "parse.y" +#line 3437 "parse.y" { yyval.ttype = make_call_declarator (NULL_TREE, yyvsp[-3].ttype, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 657: -#line 3435 "parse.y" +#line 3439 "parse.y" { set_quals_and_spec (yyval.ttype, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 658: -#line 3437 "parse.y" +#line 3441 "parse.y" { set_quals_and_spec (yyval.ttype, yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 659: -#line 3439 "parse.y" +#line 3443 "parse.y" { yyval.ttype = build_parse_node (ARRAY_REF, NULL_TREE, yyvsp[-1].ttype); ; break;} case 660: -#line 3441 "parse.y" +#line 3445 "parse.y" { yyval.ttype = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); ; break;} case 666: -#line 3465 "parse.y" +#line 3469 "parse.y" { do_pushlevel (); ; break;} case 667: -#line 3470 "parse.y" +#line 3474 "parse.y" { yyval.ttype = do_poplevel (); ; break;} case 669: -#line 3478 "parse.y" +#line 3482 "parse.y" { if (pedantic) pedwarn ("ANSI C++ forbids label declarations"); ; break;} case 672: -#line 3489 "parse.y" +#line 3493 "parse.y" { tree link; for (link = yyvsp[-1].ttype; link; link = TREE_CHAIN (link)) { @@ -7408,11 +7412,11 @@ case 672: ; break;} case 673: -#line 3503 "parse.y" +#line 3507 "parse.y" {; break;} case 675: -#line 3509 "parse.y" +#line 3513 "parse.y" { if (processing_template_decl) { @@ -7422,7 +7426,7 @@ case 675: ; break;} case 676: -#line 3517 "parse.y" +#line 3521 "parse.y" { if (processing_template_decl) { @@ -7434,7 +7438,7 @@ case 676: ; break;} case 677: -#line 3530 "parse.y" +#line 3534 "parse.y" { if (processing_template_decl) { @@ -7446,7 +7450,7 @@ case 677: ; break;} case 678: -#line 3540 "parse.y" +#line 3544 "parse.y" { if (processing_template_decl) { @@ -7467,7 +7471,7 @@ case 678: ; break;} case 679: -#line 3559 "parse.y" +#line 3563 "parse.y" { if (processing_template_decl) { @@ -7478,11 +7482,11 @@ case 679: ; break;} case 680: -#line 3571 "parse.y" +#line 3575 "parse.y" { finish_stmt (); ; break;} case 681: -#line 3573 "parse.y" +#line 3577 "parse.y" { if (processing_template_decl) { @@ -7492,7 +7496,7 @@ case 681: ; break;} case 682: -#line 3581 "parse.y" +#line 3585 "parse.y" { if (processing_template_decl) { @@ -7504,15 +7508,15 @@ case 682: ; break;} case 683: -#line 3594 "parse.y" +#line 3598 "parse.y" { finish_stmt (); ; break;} case 685: -#line 3600 "parse.y" +#line 3604 "parse.y" { finish_stmt (); ; break;} case 686: -#line 3602 "parse.y" +#line 3606 "parse.y" { tree expr = yyvsp[-1].ttype; if (! processing_template_decl) @@ -7530,11 +7534,11 @@ case 686: finish_stmt (); ; break;} case 687: -#line 3618 "parse.y" +#line 3622 "parse.y" { if (! processing_template_decl) expand_start_else (); ; break;} case 688: -#line 3620 "parse.y" +#line 3624 "parse.y" { if (processing_template_decl) { @@ -7547,17 +7551,17 @@ case 688: ; break;} case 689: -#line 3631 "parse.y" +#line 3635 "parse.y" { finish_stmt (); ; break;} case 690: -#line 3633 "parse.y" +#line 3637 "parse.y" { if (! processing_template_decl) expand_end_cond (); do_poplevel (); finish_stmt (); ; break;} case 691: -#line 3637 "parse.y" +#line 3641 "parse.y" { if (processing_template_decl) { @@ -7574,7 +7578,7 @@ case 691: ; break;} case 692: -#line 3652 "parse.y" +#line 3656 "parse.y" { if (processing_template_decl) { @@ -7595,7 +7599,7 @@ case 692: ; break;} case 693: -#line 3671 "parse.y" +#line 3675 "parse.y" { if (processing_template_decl) { @@ -7609,7 +7613,7 @@ case 693: ; break;} case 694: -#line 3683 "parse.y" +#line 3687 "parse.y" { if (processing_template_decl) { @@ -7625,7 +7629,7 @@ case 694: ; break;} case 695: -#line 3697 "parse.y" +#line 3701 "parse.y" { if (processing_template_decl) { @@ -7641,7 +7645,7 @@ case 695: ; break;} case 696: -#line 3711 "parse.y" +#line 3715 "parse.y" { if (processing_template_decl) TREE_OPERAND (yyvsp[-5].ttype, 1) = yyvsp[-1].ttype; @@ -7656,7 +7660,7 @@ case 696: ; break;} case 697: -#line 3724 "parse.y" +#line 3728 "parse.y" { if (processing_template_decl) { yyval.ttype = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE, @@ -7677,7 +7681,7 @@ case 697: ; break;} case 698: -#line 3743 "parse.y" +#line 3747 "parse.y" { if (processing_template_decl) { @@ -7697,7 +7701,7 @@ case 698: ; break;} case 699: -#line 3761 "parse.y" +#line 3765 "parse.y" { if (processing_template_decl) { @@ -7718,7 +7722,7 @@ case 699: ; break;} case 700: -#line 3782 "parse.y" +#line 3786 "parse.y" { if (processing_template_decl) TREE_OPERAND (yyvsp[-9].ttype, 2) = yyvsp[-1].ttype; @@ -7726,7 +7730,7 @@ case 700: ; break;} case 701: -#line 3788 "parse.y" +#line 3792 "parse.y" { if (processing_template_decl) { @@ -7749,7 +7753,7 @@ case 701: finish_stmt (); ; break;} case 702: -#line 3809 "parse.y" +#line 3813 "parse.y" { if (processing_template_decl) { @@ -7768,7 +7772,7 @@ case 702: ; break;} case 703: -#line 3826 "parse.y" +#line 3830 "parse.y" { if (processing_template_decl) { @@ -7783,23 +7787,23 @@ case 703: ; break;} case 704: -#line 3839 "parse.y" +#line 3843 "parse.y" { finish_stmt (); ; break;} case 705: -#line 3841 "parse.y" +#line 3845 "parse.y" { do_case (yyvsp[-1].ttype, NULL_TREE); ; break;} case 707: -#line 3844 "parse.y" +#line 3848 "parse.y" { do_case (yyvsp[-3].ttype, yyvsp[-1].ttype); ; break;} case 709: -#line 3847 "parse.y" +#line 3851 "parse.y" { do_case (NULL_TREE, NULL_TREE); ; break;} case 711: -#line 3850 "parse.y" +#line 3854 "parse.y" { emit_line_note (input_filename, lineno); if (processing_template_decl) add_tree (build_min_nt (BREAK_STMT)); @@ -7807,7 +7811,7 @@ case 711: error ("break statement not within loop or switch"); ; break;} case 712: -#line 3856 "parse.y" +#line 3860 "parse.y" { emit_line_note (input_filename, lineno); if (processing_template_decl) add_tree (build_min_nt (CONTINUE_STMT)); @@ -7815,19 +7819,19 @@ case 712: error ("continue statement not within a loop"); ; break;} case 713: -#line 3862 "parse.y" +#line 3866 "parse.y" { emit_line_note (input_filename, lineno); c_expand_return (NULL_TREE); ; break;} case 714: -#line 3865 "parse.y" +#line 3869 "parse.y" { emit_line_note (input_filename, lineno); c_expand_return (yyvsp[-1].ttype); finish_stmt (); ; break;} case 715: -#line 3870 "parse.y" +#line 3874 "parse.y" { if (TREE_CHAIN (yyvsp[-2].ttype)) yyvsp[-2].ttype = combine_strings (yyvsp[-2].ttype); emit_line_note (input_filename, lineno); expand_asm (yyvsp[-2].ttype); @@ -7835,7 +7839,7 @@ case 715: ; break;} case 716: -#line 3877 "parse.y" +#line 3881 "parse.y" { if (TREE_CHAIN (yyvsp[-4].ttype)) yyvsp[-4].ttype = combine_strings (yyvsp[-4].ttype); emit_line_note (input_filename, lineno); c_expand_asm_operands (yyvsp[-4].ttype, yyvsp[-2].ttype, NULL_TREE, NULL_TREE, @@ -7845,7 +7849,7 @@ case 716: ; break;} case 717: -#line 3886 "parse.y" +#line 3890 "parse.y" { if (TREE_CHAIN (yyvsp[-6].ttype)) yyvsp[-6].ttype = combine_strings (yyvsp[-6].ttype); emit_line_note (input_filename, lineno); c_expand_asm_operands (yyvsp[-6].ttype, yyvsp[-4].ttype, yyvsp[-2].ttype, NULL_TREE, @@ -7855,7 +7859,7 @@ case 717: ; break;} case 718: -#line 3896 "parse.y" +#line 3900 "parse.y" { if (TREE_CHAIN (yyvsp[-8].ttype)) yyvsp[-8].ttype = combine_strings (yyvsp[-8].ttype); emit_line_note (input_filename, lineno); c_expand_asm_operands (yyvsp[-8].ttype, yyvsp[-6].ttype, yyvsp[-4].ttype, yyvsp[-2].ttype, @@ -7865,7 +7869,7 @@ case 718: ; break;} case 719: -#line 3904 "parse.y" +#line 3908 "parse.y" { if (processing_template_decl) add_tree (build_min_nt (GOTO_STMT, yyvsp[-1].ttype)); @@ -7875,7 +7879,7 @@ case 719: ; break;} case 720: -#line 3912 "parse.y" +#line 3916 "parse.y" { if (processing_template_decl) add_tree (build_min_nt (GOTO_STMT, yyvsp[-1].ttype)); @@ -7890,21 +7894,21 @@ case 720: ; break;} case 721: -#line 3925 "parse.y" +#line 3929 "parse.y" { finish_stmt (); ; break;} case 722: -#line 3927 "parse.y" +#line 3931 "parse.y" { error ("label must be followed by statement"); yyungetc ('}', 0); finish_stmt (); ; break;} case 723: -#line 3931 "parse.y" +#line 3935 "parse.y" { finish_stmt (); ; break;} case 725: -#line 3937 "parse.y" +#line 3941 "parse.y" { if (! current_function_parms_stored) store_parm_decls (); @@ -7912,11 +7916,11 @@ case 725: ; break;} case 726: -#line 3943 "parse.y" +#line 3947 "parse.y" { expand_start_all_catch (); ; break;} case 727: -#line 3945 "parse.y" +#line 3949 "parse.y" { int nested = (hack_decl_function_context (current_function_decl) != NULL_TREE); @@ -7925,7 +7929,7 @@ case 727: ; break;} case 728: -#line 3955 "parse.y" +#line 3959 "parse.y" { if (processing_template_decl) { @@ -7941,7 +7945,7 @@ case 728: ; break;} case 729: -#line 3969 "parse.y" +#line 3973 "parse.y" { if (processing_template_decl) { @@ -7954,7 +7958,7 @@ case 729: ; break;} case 730: -#line 3980 "parse.y" +#line 3984 "parse.y" { if (processing_template_decl) { @@ -7967,7 +7971,7 @@ case 730: ; break;} case 733: -#line 3999 "parse.y" +#line 4003 "parse.y" { if (processing_template_decl) { @@ -7978,7 +7982,7 @@ case 733: ; break;} case 734: -#line 4008 "parse.y" +#line 4012 "parse.y" { if (processing_template_decl) { @@ -7989,7 +7993,7 @@ case 734: ; break;} case 735: -#line 4017 "parse.y" +#line 4021 "parse.y" { if (processing_template_decl) { @@ -8002,17 +8006,17 @@ case 735: ; break;} case 739: -#line 4037 "parse.y" +#line 4041 "parse.y" { expand_start_catch_block (NULL_TREE, NULL_TREE); ; break;} case 740: -#line 4053 "parse.y" +#line 4057 "parse.y" { check_for_new_type ("inside exception declarations", yyvsp[-1].ftype); expand_start_catch_block (TREE_PURPOSE (yyvsp[-1].ftype.t), TREE_VALUE (yyvsp[-1].ftype.t)); ; break;} case 741: -#line 4060 "parse.y" +#line 4064 "parse.y" { tree label; do_label: label = define_label (input_filename, lineno, yyvsp[-1].ttype); @@ -8021,129 +8025,129 @@ case 741: ; break;} case 742: -#line 4067 "parse.y" -{ goto do_label; ; - break;} -case 743: -#line 4069 "parse.y" -{ goto do_label; ; - break;} -case 744: #line 4071 "parse.y" +{ goto do_label; ; + break;} +case 743: +#line 4073 "parse.y" +{ goto do_label; ; + break;} +case 744: +#line 4075 "parse.y" { goto do_label; ; break;} case 745: -#line 4076 "parse.y" +#line 4080 "parse.y" { if (yyvsp[-1].ttype) cplus_expand_expr_stmt (yyvsp[-1].ttype); ; break;} case 747: -#line 4079 "parse.y" +#line 4083 "parse.y" { if (pedantic) pedwarn ("ANSI C++ forbids compound statements inside for initializations"); ; break;} case 748: -#line 4088 "parse.y" +#line 4092 "parse.y" { emit_line_note (input_filename, lineno); yyval.ttype = NULL_TREE; ; break;} case 749: -#line 4091 "parse.y" +#line 4095 "parse.y" { emit_line_note (input_filename, lineno); ; break;} case 750: -#line 4096 "parse.y" +#line 4100 "parse.y" { yyval.ttype = NULL_TREE; ; break;} case 752: -#line 4099 "parse.y" +#line 4103 "parse.y" { yyval.ttype = NULL_TREE; ; break;} case 753: -#line 4106 "parse.y" +#line 4110 "parse.y" { yyval.ttype = NULL_TREE; ; break;} case 756: -#line 4113 "parse.y" +#line 4117 "parse.y" { yyval.ttype = chainon (yyval.ttype, yyvsp[0].ttype); ; break;} case 757: -#line 4118 "parse.y" +#line 4122 "parse.y" { yyval.ttype = build_tree_list (yyval.ttype, yyvsp[-1].ttype); ; break;} case 758: -#line 4123 "parse.y" +#line 4127 "parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyval.ttype, NULL_TREE); ; break;} case 759: -#line 4125 "parse.y" +#line 4129 "parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ttype, yyval.ttype); ; break;} case 760: -#line 4136 "parse.y" +#line 4140 "parse.y" { yyval.ttype = empty_parms(); ; break;} case 762: -#line 4141 "parse.y" +#line 4145 "parse.y" { yyval.ttype = tree_cons (NULL_TREE, yyvsp[0].ftype.t, void_list_node); TREE_PARMLIST (yyval.ttype) = 1; check_for_new_type ("inside parameter list", yyvsp[0].ftype); ; break;} case 763: -#line 4150 "parse.y" +#line 4154 "parse.y" { yyval.ttype = chainon (yyval.ttype, void_list_node); TREE_PARMLIST (yyval.ttype) = 1; ; break;} case 764: -#line 4155 "parse.y" +#line 4159 "parse.y" { TREE_PARMLIST (yyval.ttype) = 1; ; break;} case 765: -#line 4160 "parse.y" +#line 4164 "parse.y" { TREE_PARMLIST (yyval.ttype) = 1; ; break;} case 766: -#line 4164 "parse.y" +#line 4168 "parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[-1].ftype.t); TREE_PARMLIST (yyval.ttype) = 1; ; break;} case 767: -#line 4169 "parse.y" +#line 4173 "parse.y" { yyval.ttype = NULL_TREE; ; break;} case 768: -#line 4173 "parse.y" -{ - TREE_PARMLIST (yyval.ttype) = 1; - ; - break;} -case 769: #line 4177 "parse.y" { TREE_PARMLIST (yyval.ttype) = 1; ; break;} -case 770: +case 769: #line 4181 "parse.y" +{ + TREE_PARMLIST (yyval.ttype) = 1; + ; + break;} +case 770: +#line 4185 "parse.y" { yyval.ttype = build_tree_list (NULL_TREE, yyvsp[-1].ftype.t); TREE_PARMLIST (yyval.ttype) = 1; ; break;} case 771: -#line 4186 "parse.y" +#line 4190 "parse.y" { /* This helps us recover from really nasty parse errors, for example, a missing right @@ -8156,7 +8160,7 @@ case 771: ; break;} case 772: -#line 4197 "parse.y" +#line 4201 "parse.y" { /* This helps us recover from really nasty parse errors, for example, a missing right @@ -8169,98 +8173,98 @@ case 772: ; break;} case 773: -#line 4212 "parse.y" +#line 4216 "parse.y" { maybe_snarf_defarg (); ; break;} case 774: -#line 4214 "parse.y" +#line 4218 "parse.y" { yyval.ttype = yyvsp[0].ttype; ; break;} case 777: -#line 4225 "parse.y" +#line 4229 "parse.y" { check_for_new_type ("in a parameter list", yyvsp[0].ftype); yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ftype.t); ; break;} case 778: -#line 4228 "parse.y" +#line 4232 "parse.y" { check_for_new_type ("in a parameter list", yyvsp[-1].ftype); yyval.ttype = build_tree_list (yyvsp[0].ttype, yyvsp[-1].ftype.t); ; break;} case 779: -#line 4231 "parse.y" +#line 4235 "parse.y" { check_for_new_type ("in a parameter list", yyvsp[0].ftype); yyval.ttype = chainon (yyval.ttype, yyvsp[0].ftype.t); ; break;} case 780: -#line 4234 "parse.y" +#line 4238 "parse.y" { yyval.ttype = chainon (yyval.ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ; break;} case 781: -#line 4236 "parse.y" +#line 4240 "parse.y" { yyval.ttype = chainon (yyval.ttype, build_tree_list (yyvsp[0].ttype, yyvsp[-2].ttype)); ; break;} case 783: -#line 4242 "parse.y" +#line 4246 "parse.y" { check_for_new_type ("in a parameter list", yyvsp[-1].ftype); yyval.ttype = build_tree_list (NULL_TREE, yyvsp[-1].ftype.t); ; break;} case 784: -#line 4252 "parse.y" +#line 4256 "parse.y" { tree specs = strip_attrs (yyvsp[-1].ftype.t); yyval.ftype.new_type_flag = yyvsp[-1].ftype.new_type_flag; yyval.ftype.t = build_tree_list (specs, yyvsp[0].ttype); ; break;} case 785: -#line 4256 "parse.y" +#line 4260 "parse.y" { yyval.ftype.t = build_tree_list (yyvsp[-1].ftype.t, yyvsp[0].ttype); yyval.ftype.new_type_flag = yyvsp[-1].ftype.new_type_flag; ; break;} case 786: -#line 4259 "parse.y" +#line 4263 "parse.y" { yyval.ftype.t = build_tree_list (get_decl_list (yyvsp[-1].ftype.t), yyvsp[0].ttype); yyval.ftype.new_type_flag = yyvsp[-1].ftype.new_type_flag; ; break;} case 787: -#line 4262 "parse.y" +#line 4266 "parse.y" { tree specs = strip_attrs (yyvsp[-1].ftype.t); yyval.ftype.t = build_tree_list (specs, yyvsp[0].ttype); yyval.ftype.new_type_flag = yyvsp[-1].ftype.new_type_flag; ; break;} case 788: -#line 4266 "parse.y" +#line 4270 "parse.y" { tree specs = strip_attrs (yyvsp[0].ftype.t); yyval.ftype.t = build_tree_list (specs, NULL_TREE); yyval.ftype.new_type_flag = yyvsp[0].ftype.new_type_flag; ; break;} case 789: -#line 4270 "parse.y" +#line 4274 "parse.y" { tree specs = strip_attrs (yyvsp[-1].ttype); yyval.ftype.t = build_tree_list (specs, yyvsp[0].ttype); yyval.ftype.new_type_flag = 0; ; break;} case 790: -#line 4277 "parse.y" +#line 4281 "parse.y" { yyval.ftype.t = build_tree_list (NULL_TREE, yyvsp[0].ftype.t); yyval.ftype.new_type_flag = yyvsp[0].ftype.new_type_flag; ; break;} case 791: -#line 4280 "parse.y" +#line 4284 "parse.y" { yyval.ftype.t = build_tree_list (yyvsp[0].ttype, yyvsp[-1].ftype.t); yyval.ftype.new_type_flag = yyvsp[-1].ftype.new_type_flag; ; break;} case 794: -#line 4291 "parse.y" +#line 4295 "parse.y" { see_typename (); ; break;} case 795: -#line 4296 "parse.y" +#line 4300 "parse.y" { error ("type specifier omitted for parameter"); yyval.ttype = build_tree_list (integer_type_node, NULL_TREE); ; break;} case 796: -#line 4301 "parse.y" +#line 4305 "parse.y" { error ("type specifier omitted for parameter"); if (TREE_CODE (yyval.ttype) == SCOPE_REF @@ -8271,188 +8275,188 @@ case 796: ; break;} case 797: -#line 4313 "parse.y" +#line 4317 "parse.y" { yyval.ttype = NULL_TREE; ; break;} case 798: -#line 4315 "parse.y" +#line 4319 "parse.y" { yyval.ttype = yyvsp[-1].ttype; ; break;} case 799: -#line 4317 "parse.y" +#line 4321 "parse.y" { yyval.ttype = build_decl_list (NULL_TREE, NULL_TREE); ; break;} case 800: -#line 4322 "parse.y" +#line 4326 "parse.y" { yyval.ttype = build_decl_list (NULL_TREE, groktypename(yyvsp[0].ftype.t)); ; break;} case 802: -#line 4328 "parse.y" +#line 4332 "parse.y" { TREE_CHAIN (yyvsp[0].ttype) = yyval.ttype; yyval.ttype = yyvsp[0].ttype; ; break;} case 803: -#line 4336 "parse.y" +#line 4340 "parse.y" { yyval.ttype = NULL_TREE; ; break;} case 804: -#line 4338 "parse.y" +#line 4342 "parse.y" { yyval.ttype = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 805: -#line 4340 "parse.y" +#line 4344 "parse.y" { yyval.ttype = make_reference_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); ; break;} case 806: -#line 4342 "parse.y" +#line 4346 "parse.y" { tree arg = make_pointer_declarator (yyvsp[-1].ttype, yyvsp[0].ttype); yyval.ttype = build_parse_node (SCOPE_REF, yyvsp[-2].ttype, arg); ; break;} case 807: -#line 4349 "parse.y" +#line 4353 "parse.y" { got_scope = NULL_TREE; ; break;} case 808: -#line 4354 "parse.y" +#line 4358 "parse.y" { yyval.ttype = ansi_opname[MULT_EXPR]; ; break;} case 809: -#line 4356 "parse.y" +#line 4360 "parse.y" { yyval.ttype = ansi_opname[TRUNC_DIV_EXPR]; ; break;} case 810: -#line 4358 "parse.y" +#line 4362 "parse.y" { yyval.ttype = ansi_opname[TRUNC_MOD_EXPR]; ; break;} case 811: -#line 4360 "parse.y" +#line 4364 "parse.y" { yyval.ttype = ansi_opname[PLUS_EXPR]; ; break;} case 812: -#line 4362 "parse.y" +#line 4366 "parse.y" { yyval.ttype = ansi_opname[MINUS_EXPR]; ; break;} case 813: -#line 4364 "parse.y" +#line 4368 "parse.y" { yyval.ttype = ansi_opname[BIT_AND_EXPR]; ; break;} case 814: -#line 4366 "parse.y" +#line 4370 "parse.y" { yyval.ttype = ansi_opname[BIT_IOR_EXPR]; ; break;} case 815: -#line 4368 "parse.y" +#line 4372 "parse.y" { yyval.ttype = ansi_opname[BIT_XOR_EXPR]; ; break;} case 816: -#line 4370 "parse.y" +#line 4374 "parse.y" { yyval.ttype = ansi_opname[BIT_NOT_EXPR]; ; break;} case 817: -#line 4372 "parse.y" +#line 4376 "parse.y" { yyval.ttype = ansi_opname[COMPOUND_EXPR]; ; break;} case 818: -#line 4374 "parse.y" +#line 4378 "parse.y" { yyval.ttype = ansi_opname[yyvsp[0].code]; ; break;} case 819: -#line 4376 "parse.y" +#line 4380 "parse.y" { yyval.ttype = ansi_opname[LT_EXPR]; ; break;} case 820: -#line 4378 "parse.y" +#line 4382 "parse.y" { yyval.ttype = ansi_opname[GT_EXPR]; ; break;} case 821: -#line 4380 "parse.y" +#line 4384 "parse.y" { yyval.ttype = ansi_opname[yyvsp[0].code]; ; break;} case 822: -#line 4382 "parse.y" +#line 4386 "parse.y" { yyval.ttype = ansi_assopname[yyvsp[0].code]; ; break;} case 823: -#line 4384 "parse.y" +#line 4388 "parse.y" { yyval.ttype = ansi_opname [MODIFY_EXPR]; ; break;} case 824: -#line 4386 "parse.y" +#line 4390 "parse.y" { yyval.ttype = ansi_opname[yyvsp[0].code]; ; break;} case 825: -#line 4388 "parse.y" +#line 4392 "parse.y" { yyval.ttype = ansi_opname[yyvsp[0].code]; ; break;} case 826: -#line 4390 "parse.y" +#line 4394 "parse.y" { yyval.ttype = ansi_opname[POSTINCREMENT_EXPR]; ; break;} case 827: -#line 4392 "parse.y" +#line 4396 "parse.y" { yyval.ttype = ansi_opname[PREDECREMENT_EXPR]; ; break;} case 828: -#line 4394 "parse.y" +#line 4398 "parse.y" { yyval.ttype = ansi_opname[TRUTH_ANDIF_EXPR]; ; break;} case 829: -#line 4396 "parse.y" +#line 4400 "parse.y" { yyval.ttype = ansi_opname[TRUTH_ORIF_EXPR]; ; break;} case 830: -#line 4398 "parse.y" +#line 4402 "parse.y" { yyval.ttype = ansi_opname[TRUTH_NOT_EXPR]; ; break;} case 831: -#line 4400 "parse.y" +#line 4404 "parse.y" { yyval.ttype = ansi_opname[COND_EXPR]; ; break;} case 832: -#line 4402 "parse.y" +#line 4406 "parse.y" { yyval.ttype = ansi_opname[yyvsp[0].code]; ; break;} case 833: -#line 4404 "parse.y" +#line 4408 "parse.y" { yyval.ttype = ansi_opname[COMPONENT_REF]; ; break;} case 834: -#line 4406 "parse.y" +#line 4410 "parse.y" { yyval.ttype = ansi_opname[MEMBER_REF]; ; break;} case 835: -#line 4408 "parse.y" +#line 4412 "parse.y" { yyval.ttype = ansi_opname[CALL_EXPR]; ; break;} case 836: -#line 4410 "parse.y" +#line 4414 "parse.y" { yyval.ttype = ansi_opname[ARRAY_REF]; ; break;} case 837: -#line 4412 "parse.y" +#line 4416 "parse.y" { yyval.ttype = ansi_opname[NEW_EXPR]; ; break;} case 838: -#line 4414 "parse.y" +#line 4418 "parse.y" { yyval.ttype = ansi_opname[DELETE_EXPR]; ; break;} case 839: -#line 4416 "parse.y" +#line 4420 "parse.y" { yyval.ttype = ansi_opname[VEC_NEW_EXPR]; ; break;} case 840: -#line 4418 "parse.y" +#line 4422 "parse.y" { yyval.ttype = ansi_opname[VEC_DELETE_EXPR]; ; break;} case 841: -#line 4421 "parse.y" +#line 4425 "parse.y" { yyval.ttype = grokoptypename (yyvsp[-1].ftype.t, yyvsp[0].ttype); ; break;} case 842: -#line 4423 "parse.y" +#line 4427 "parse.y" { yyval.ttype = ansi_opname[ERROR_MARK]; ; break;} } @@ -8653,7 +8657,7 @@ yyerrhandle: yystate = yyn; goto yynewstate; } -#line 4426 "parse.y" +#line 4430 "parse.y" #ifdef SPEW_DEBUG diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 45e14a7507c..ddaca24fa73 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -3309,8 +3309,12 @@ typename_sub2: TYPENAME SCOPE { if (TREE_CODE ($1) != IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$ = complete_type (TREE_TYPE ($$)); + $1 = lastiddecl; + + got_scope = $$ = complete_type (TREE_TYPE ($1)); + + if ($$ == error_mark_node) + cp_error ("`%T' is not a class or namespace", $1); } | SELFNAME SCOPE { diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ba1d884e38e..6c3508f3421 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -866,6 +866,9 @@ check_explicit_specialization (declarator, decl, template_count, flags) SET_DECL_EXPLICIT_INSTANTIATION (decl); return decl; } + else if (DECL_STATIC_FUNCTION_P (tmpl) + && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + revert_static_member_fn (&decl, 0, 0); /* Mangle the function name appropriately. Note that we do not mangle specializations of non-template member @@ -1822,11 +1825,23 @@ coerce_template_parms (parms, arglist, in_decl, continue; } - /* In case we are checking arguments inside a template template - parameter, ARG that does not come from default argument is - also a TREE_LIST node */ - if (TREE_CODE (arg) == TREE_LIST && ! is_overloaded_fn (arg)) + if (TREE_CODE (arg) == TREE_LIST + && TREE_TYPE (arg) != NULL_TREE + && TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE) + { + /* The template argument was the name of some + member function. That's usually + illegal, but static members are OK. In any + case, grab the underlying fields/functions + and issue an error later if required. */ + arg = TREE_VALUE (arg); + TREE_TYPE (arg) = unknown_type_node; + } + else if (TREE_CODE (arg) == TREE_LIST && ! is_overloaded_fn (arg)) { + /* In case we are checking arguments inside a template template + parameter, ARG that does not come from default argument is + also a TREE_LIST node */ is_tmpl_parm = 1; arg = TREE_VALUE (arg); } diff --git a/gcc/cp/search.c b/gcc/cp/search.c index b059fbdb589..75b32667efd 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -3220,6 +3220,10 @@ note_debug_info_needed (type) if (current_template_parms) return; + + if (TYPE_BEING_DEFINED (type)) + /* We can't go looking for the base types and fields just yet. */ + return; /* We can't do the TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which does not support name references between translation units. Well, we diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index f401d68a1e3..eff72af2bea 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -136,6 +136,11 @@ tree complete_type (type) tree type; { + if (type == NULL_TREE) + /* Rather than crash, we return something sure to cause an error + at some point. */ + return error_mark_node; + if (type == error_mark_node || TYPE_SIZE (type) != NULL_TREE) ; else if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))