public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14693] New: Parse error using operator<<
@ 2004-03-23 13:58 loose at astron dot nl
  2004-03-23 14:08 ` [Bug c++/14693] " bangerth at dealii dot org
  0 siblings, 1 reply; 2+ messages in thread
From: loose at astron dot nl @ 2004-03-23 13:58 UTC (permalink / raw)
  To: gcc-bugs

The following code demonstrates a parse error. I've run this code through 
several version of the g++ compiler (2.95.3, 3.1, 3.2.1, 3.2.3 and 3.3.2) and 
all exhibit the same behaviour. To check the validity of the code I also ran it 
through the Intel C++ compiler (v8.0) and it compiled fine.

$ cat g++-parser-bug.cc
#include <iostream>

using namespace std;

class Expr
{
public:
  Expr() {}
  friend Expr operator>(const Expr& lhs, const Expr& rhs) { return Expr(); }
  friend ostream& operator<<(ostream& os, const Expr& e) { return os; }
};

int main()
{
  cout << (Expr() > Expr()) << endl;
}

$ g++ -v -save-temps g++-parser-bug.cc
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-
checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cpp0 -lang-c++ -D__GNUG__=3 -
D__DEPRECATED -D__EXCEPTIONS -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -
D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -
D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -
D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -
D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -
D__tune_i386__ g++-parser-bug.cc g++-parser-bug.ii
GNU CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.2.2
 /usr/include/c++/3.2.2/i386-redhat-linux
 /usr/include/c++/3.2.2/backward
 /usr/local/include
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cc1plus -fpreprocessed g++-parser-
bug.ii -quiet -dumpbase g++-parser-bug.cc -version -o g++-parser-bug.s
GNU CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386-redhat-linux)
        compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
g++-parser-bug.cc: In function `int main()':
g++-parser-bug.cc:15: parse error before `>' token

-- 
           Summary: Parse error using operator<<
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: loose at astron dot nl
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/14693] Parse error using operator<<
  2004-03-23 13:58 [Bug c++/14693] New: Parse error using operator<< loose at astron dot nl
@ 2004-03-23 14:08 ` bangerth at dealii dot org
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth at dealii dot org @ 2004-03-23 14:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-03-23 14:08 -------
Confirmed. This is another instance of the parser bug described 
on our bugs page. It is fixed in 3.4.0 and mainline, though. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |rejects-valid
      Known to fail|                            |3.3.4
      Known to work|                            |3.4.0 3.5.0
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


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


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

end of thread, other threads:[~2004-03-23 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-23 13:58 [Bug c++/14693] New: Parse error using operator<< loose at astron dot nl
2004-03-23 14:08 ` [Bug c++/14693] " bangerth at dealii 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).