From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10637 invoked by alias); 27 Sep 2002 16:09:31 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 9240 invoked from network); 27 Sep 2002 16:09:11 -0000 Received: from unknown (HELO wiesinger.com) (195.34.140.110) by sources.redhat.com with SMTP; 27 Sep 2002 16:09:11 -0000 Received: from bbs.intern (localhost [127.0.0.1]) by wiesinger.com (8.12.6/8.12.6) with ESMTP id g8RG9Ak6008723 for ; Fri, 27 Sep 2002 18:09:10 +0200 Received: from localhost (gerhard@localhost) by bbs.intern (8.12.6/8.12.6/Submit) with ESMTP id g8RG98vG008720 for ; Fri, 27 Sep 2002 18:09:08 +0200 X-Authentication-Warning: bbs.intern: gerhard owned process doing -bs Date: Fri, 27 Sep 2002 09:09:00 -0000 From: gcc@wiesinger.com X-X-Sender: gerhard@bbs.intern To: gcc-help@gcc.gnu.org Subject: GCC compile problem ... Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-09/txt/msg00213.txt.bz2 Hello! I have the following compile problem with gcc 3.0.4. Borland C++ 5.5 and Microsoft Visual C++ 6.0 works well. #include #include using namespace std; class Test { public: string getString() { return "hallo"; } }; int main(int argc, char* argv) { Test test; string& s = test.getString(); // Error here // works well: string s = test.getString(); cout << s << "\n"; // gcc --version: 3.0.4 } main.cpp: In function `int main (int, char *)': main.cpp:17: initialization of non-const reference type `class string &' main.cpp:17: from rvalue of type `basic_string, __default_alloc_template >' make[1]: *** [main.o] Error 1 Why aren't there references allowed here with gcc? Is this not Ansi C++ conform? Ciao, Gerhard