specifically, this:

class A
{
public:
    A(float* a, float* b);
};

void foo(void)
{
    float array[3] = { 12, 13, 14 };

#if defined(GCC_WORKS)
    A(&array[0], &array[3]);
#else
    A(array, &array[3]);
#endif
}

compiled with g++ test.cpp -DGCC_WORKS, you get:
test.cpp: In function `void foo()':
test.cpp:12: error: parse error before `,' token

compiled with g++ test.cpp, there are no errors.  I would expect those two code 
fragments to be 
identical in behavior.

making a named variable:
A a(&array[0], &array[3]);
works.

calling a function:
bar(A(&array[0], &array[3]));
works.

calling a constructor:
B b(A(&array[0], &array[3]));
doesn't work.

tested on mandrake linux:
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib 
--mandir=/usr/
share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix 
--disable-checking --
enable-long-long --enable-__cxa_atexit --enable-clocale=gnu 
--enable-languages=c,c++,ada,f77,
objc,java,pascal --host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)

and mac os x:
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1660)

-- 
           Summary: &array[0] syntax causes parse error in certain
                    circumstances
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: onesadcookie at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to