This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14181] New: Cryptic error message for code that compiled without warnings in 3.3.x


I have the following code that compiles without warnings with g++ 3.3.2
(x86-pc-linux) and 3.3.1 (mipsel-linux).  But I get an error under 3.4.

Not being a C++ expert, can someone tell me if my code is bogus, or if this is a
problem with 3.4.

Here is the code:

----------d1.cpp--------8<------------------------
char **
f1()
{
   char** pSections;
     // allocate an array of 10 char pointers.
   pSections = new (char*)[10];
     return pSections;
  }
---------------8<----------------------------

These are the errors:

[daney@dl junk]$ mipsel-linux-g++ --version
mipsel-linux-g++ (GCC) 3.4.0 20040214 (prerelease)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[daney@dl junk]$ mipsel-linux-g++ -c d1.cpp
d1.cpp: In function `char** f1()':
d1.cpp:7: error: expected `;' before '[' token


Perhaps it should say something like:  Parenthesized type name no longer allowed
in new type[] expressions...

-- 
           Summary: Cryptic error message for code that compiled without
                    warnings in 3.3.x
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: daney at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: *
  GCC host triplet: *
GCC target triplet: *


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]