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++/11253] New: Parsing error with anonymous class instantiation


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Parsing error with anonymous class instantiation
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: marko@ixiacom.com
                CC: gcc-bugs@gcc.gnu.org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux

This legal program compiles fine:

#include <sstream>

int main(int argc,const char *const argv[])
{
    int x;
    (std::istringstream(argv[1])) >> x;
    return x;
}


but removing the redundant parentheses:

#include <sstream>

int main(int argc,const char *const argv[])
{
    int x;
    std::istringstream(argv[1]) >> x;
    return x;
}

causes gcc to generate this diagnostic output:

prog.C: In function `int main(int, const char* const*)':
prog.C:6: declaration of `argv' shadows a parameter
prog.C:6: parse error before `>>' token

It appears gcc thinks a function is being declared.


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