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++/18901] New: Type of 'new (T*) [n]'


Dear all,

I would like to post a fault report for the GNU C/C++ compiler 3.3-e500.

We use the compiler to generate code for a PowerPC processor.

Used invokation line for the GNU C++ compiler:

ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig
      -fmerge-templates -mmultiple -mno-string -mstrict-align -O3
      -fno-exceptions -fno-rtti -fno-builtin-printf
      -I<different include paths>
      -D<differen #define's>
      K.CPP -oK.O


// example program

void f1 (int*);
void f2 (int**);

void f3 ()
{
    f1 (new (int*)[3]);         // legal
    f2 (new (int*)[3]);         // illegal
}

I get the error message "cannot convert `int**' to `int*' for argument `1'
to `void f1(int*)'".

I think this is unjustified since the expression 'new (int*)[n]' should be
parsed as '(new (int*))[n]' and not as 'new int*[n]' as the GNU compiler
seems to do: according to the standard 5.3.4 the above '(int*)' in the new-
expression should be recognized as '( type-id )'.

Therefore the compiler should accept the call of f1() and refuse the call
of f2().

With kind regards
W. Roehrl

-- 
           Summary: Type of 'new (T*) [n]'
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wolfgang dot roehrl at de dot gi-de dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.5.1
  GCC host triplet: i386-pc-mingw32
GCC target triplet: powerpc-wrs-vxworks


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


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