Bug: gcc/cp/parse.y & gcc/cp/decl.h: Conflict on TYPENAME

Akim Demaille akim@epita.fr
Wed Jun 12 04:17:00 GMT 2002


The following patch supersedes my previous patch: it addresses two
parser related issues: one is that:

| | The parser declares token TYPENAME and decl.h declares an enum
| | including TYPENAME.  Several files include both, what results in a
| | dangerous clash.
| | 
| | Given the risks, I suggest that the parser slowly moves to using the
| | `tFOO' convention, so, amongst the various possible changes, I
| | preferred this one: instead of token TYPENAME, using token tTYPENAME.
| | If you have another preference, please tell me, I'll adjust the patch
| | accordingly.
|
| Without this patch, expect next Bison to create a failure of the
| compilation: it nows outputs the tokens as enums (when __STDC__), and
| therefore, the compilation will fail (as is to be expected from id
| clashes).

And the second issue is a typing issue.  On a rule such as

        foo: bar {} baz;

because of the default action $$ = $1, you have to ensure %typeof (foo)
== %typeof (bar), which was not the case of these rules:


explicit_instantiation:
	[...]
	| SCSPEC TEMPLATE begin_explicit_instantiation typespec ';'
		{ do_type_instantiation ($4.t, $1, 1);
		  yyungetc (';', 1); }
          end_explicit_instantiation
		{}
        [...]

Because %type <ttype> SCSPEC.

So you have to write

        foo: bar {} baz {};

The test suite exhibits exactly the same behavior before and after
this patch, i.e.:

Test Run By akim on Wed Jun 12 12:34:58 2002
      Native configuration is i686-pc-linux-gnu
      
                      === g++ tests ===
      [..]
                      === g++ Summary ===
      
      # of expected passes            6808
      # of unexpected failures        568
      # of unexpected successes       1
      # of expected failures          86
      # of untested testcases         9
      # of unsupported tests          3
      /home/akim/src/gcc/gcc/testsuite/../g++ version gcc 3.2 20020611 (experimental)


I would like to emphasize that this patch is a simple bug fix.  As is,
this grammar does not compile with CVS Bison.



Note: I have my editor systematically remove the trailing spaces, and
there appears to be many in these files.  So the patch comes in two
``flavors'': the first one is `diff -w' so that you can see the real
content of the patch, but the real patch, which includes the trailing
blank (automated) removal, is below.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: diffs.patch
Type: text/x-patch
Size: 8537 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20020612/f79dad55/attachment.bin>
-------------- next part --------------

Now the real patch, including trailing spaces nuking.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-TYPENAME-conflict.patch.gz
Type: application/octet-stream
Size: 11260 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20020612/f79dad55/attachment.obj>


More information about the Gcc-patches mailing list