public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13736] New: [gcc-3.4 parser regression] Some compound casts rejected
@ 2004-01-19  9:11 jan at etpmod dot phys dot tue dot nl
  2004-01-19 12:19 ` [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts giovannibajo at libero dot it
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jan at etpmod dot phys dot tue dot nl @ 2004-01-19  9:11 UTC (permalink / raw)
  To: gcc-bugs

The following snippet refuses to compile with the gcc-3.4 branch (and with the 
trunk, I guess). It compiles fine with previous versions. The offending line 
and work-arounds are indicated as comments. Is it the parser, or is it me? 
 
#include <string> 
 
int main() 
{ 
  using std::string; 
 
  string s1(string( (string     )("")));   // OK 
  string s2(string( (const char*)("")));   // Does not compile 
  typedef const char* charp; 
  string s3(string( (charp)("")));         // Workaround: intermediate typedef 
  string s4((string( (const char*)("")))); // Workaround: extra parenthesis 
  return 0; 
} 
 
jan@nbjapan:~/src $ g++ t.cpp 
t.cpp: In function `int main()': 
t.cpp:8: error: expected `)' before '(' token 
t.cpp:8: error: expected `,' or `...' before '(' token 
t.cpp:8: error: expected init-declarator before ')' token 
t.cpp:8: error: expected `,' or `;' before ')' token 
 
jan@nbjapan:~/src $ g++ -v 
Reading specs from /home/jan/local/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.0/
specs 
Configured with: ../gcc-3.4/configure --prefix=/home/jan/local/gcc-3.4 
--enable-languages=c,c++ --disable-checking 
Thread model: posix 
gcc version 3.4.0 20040119 (prerelease)

-- 
           Summary: [gcc-3.4 parser regression] Some compound casts rejected
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan at etpmod dot phys dot tue dot nl
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: pc-linux-gnu
  GCC host triplet: pc-linux-gnu
GCC target triplet: pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13736


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts
  2004-01-19  9:11 [Bug c++/13736] New: [gcc-3.4 parser regression] Some compound casts rejected jan at etpmod dot phys dot tue dot nl
@ 2004-01-19 12:19 ` giovannibajo at libero dot it
  2004-01-19 12:28 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: giovannibajo at libero dot it @ 2004-01-19 12:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-01-19 12:19 -------
Confirmed, a regression on 3.4/3.5 probably caused by the new parser. A self-
contained testcase is obviously:

-------------------------------------------------
struct string
{
  string() {};
  string(const string& ) {};
  string(const char * ) {};
};

int main() 
{ 
  string s1(string( (string     )("")));   // OK 
  string s2(string( (const char*)("")));   // Does not compile 
  typedef const char* charp; 
  string s3(string( (charp)("")));         // Workaround: intermediate typedef 
  string s4((string( (const char*)("")))); // Workaround: extra parenthesis 

  return 0; 
} 
-------------------------------------------------


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-19 12:19:25
               date|                            |
            Summary|[gcc-3.4 parser regression] |[3.4/3.5 Regression] Parser
                   |Some compound casts rejected|confused on compound casts
   Target Milestone|---                         |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13736


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts
  2004-01-19  9:11 [Bug c++/13736] New: [gcc-3.4 parser regression] Some compound casts rejected jan at etpmod dot phys dot tue dot nl
  2004-01-19 12:19 ` [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts giovannibajo at libero dot it
@ 2004-01-19 12:28 ` pinskia at gcc dot gnu dot org
  2004-01-25  3:27 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-19 12:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-19 12:28 -------
>From Phil's regression hunter: Search converges between 2003-12-17-trunk (#479) and 2003-12
-18-trunk (#480).  Related to another PR which I cannot find right now.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13736


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts
  2004-01-19  9:11 [Bug c++/13736] New: [gcc-3.4 parser regression] Some compound casts rejected jan at etpmod dot phys dot tue dot nl
  2004-01-19 12:19 ` [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts giovannibajo at libero dot it
  2004-01-19 12:28 ` pinskia at gcc dot gnu dot org
@ 2004-01-25  3:27 ` pinskia at gcc dot gnu dot org
  2004-01-29  1:29 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-25  3:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-25 03:26 -------
Mark this is caused by your patch:
        PR c++/10603
        PR c++/12827
        * parser.c (cp_parser_error): Help c_parse_error print good
        messages if the next token is a keyword.
        (cp_parser_parameter_declaration_list): When resynchronizing after
        a bad parameter declaration, stop if a comma is found.
        (cp_parser_parameter_declaration): Avoid backtracking.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mmitchel at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13736


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts
  2004-01-19  9:11 [Bug c++/13736] New: [gcc-3.4 parser regression] Some compound casts rejected jan at etpmod dot phys dot tue dot nl
                   ` (2 preceding siblings ...)
  2004-01-25  3:27 ` pinskia at gcc dot gnu dot org
@ 2004-01-29  1:29 ` cvs-commit at gcc dot gnu dot org
  2004-01-29  1:34 ` cvs-commit at gcc dot gnu dot org
  2004-01-29  1:35 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-29  1:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-29 01:29 -------
Subject: Bug 13736

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-01-29 01:29:04

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: cast2.C 

Log message:
	PR c++/13736
	* parser.c (cp_parser_direct_declarator): Do not prevent
	backtracking inside a parenthesized declarator.
	(cp_parser_parameter_declaration): Fix typo in comment.
	
	PR c++/13736
	* g++.dg/parse/cast2.C (main): New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3914&r2=1.3915
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.161&r2=1.162
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3433&r2=1.3434
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/cast2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13736


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts
  2004-01-19  9:11 [Bug c++/13736] New: [gcc-3.4 parser regression] Some compound casts rejected jan at etpmod dot phys dot tue dot nl
                   ` (3 preceding siblings ...)
  2004-01-29  1:29 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-29  1:34 ` cvs-commit at gcc dot gnu dot org
  2004-01-29  1:35 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-29  1:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-29 01:34 -------
Subject: Bug 13736

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-01-29 01:33:55

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog parser.c 
Added files:
	gcc/testsuite/g++.dg/parse: cast2.C 

Log message:
	PR c++/13736
	* parser.c (cp_parser_direct_declarator): Do not prevent
	backtracking inside a parenthesized declarator.
	(cp_parser_parameter_declaration): Fix typo in comment.
	
	2004-01-28  Mark Mitchell  <mark@codesourcery.com>
	
	PR c++/13736
	* g++.dg/parse/cast2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.26&r2=1.3389.2.27
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/cast2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.18&r2=1.3892.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.4&r2=1.157.2.5



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13736


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts
  2004-01-19  9:11 [Bug c++/13736] New: [gcc-3.4 parser regression] Some compound casts rejected jan at etpmod dot phys dot tue dot nl
                   ` (4 preceding siblings ...)
  2004-01-29  1:34 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-29  1:35 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-01-29  1:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-01-29 01:35 -------
Fixed in GCC 3.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13736


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-01-29  1:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-19  9:11 [Bug c++/13736] New: [gcc-3.4 parser regression] Some compound casts rejected jan at etpmod dot phys dot tue dot nl
2004-01-19 12:19 ` [Bug c++/13736] [3.4/3.5 Regression] Parser confused on compound casts giovannibajo at libero dot it
2004-01-19 12:28 ` pinskia at gcc dot gnu dot org
2004-01-25  3:27 ` pinskia at gcc dot gnu dot org
2004-01-29  1:29 ` cvs-commit at gcc dot gnu dot org
2004-01-29  1:34 ` cvs-commit at gcc dot gnu dot org
2004-01-29  1:35 ` mmitchel at gcc dot gnu dot org

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).