From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2753 invoked by alias); 27 Mar 2003 17:06:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 2730 invoked by uid 71); 27 Mar 2003 17:06:00 -0000 Resent-Date: 27 Mar 2003 17:06:00 -0000 Resent-Message-ID: <20030327170600.2729.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, tot@trema.com, jean-paul_marinier@hp.com Resent-Reply-To: gcc-gnats@gcc.gnu.org, harri.pasanen@trema.com Received: (qmail 512 invoked by uid 48); 27 Mar 2003 16:57:29 -0000 Message-Id: <20030327165729.511.qmail@sources.redhat.com> Date: Thu, 27 Mar 2003 17:16:00 -0000 From: harri.pasanen@trema.com Reply-To: harri.pasanen@trema.com To: gcc-gnats@gcc.gnu.org Cc: tot@trema.com, jean-paul_marinier@hp.com X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify: tot@trema.com, jean-paul_marinier@hp.com Subject: c++/10245: regression in 3.3, C++ ternary operator confuses type lookup X-SW-Source: 2003-03/txt/msg01916.txt.bz2 List-Id: >Number: 10245 >Category: c++ >Synopsis: regression in 3.3, C++ ternary operator confuses type lookup >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Mar 27 17:06:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: harri.pasanen@trema.com >Release: unknown-1.0 >Organization: >Environment: gcc version 3.3 20030326 (prerelease) >Description: // Ternary operator throws the type resolution of balance. namespace Type { struct Date { int foo; }; }; typedef int fc_Date; struct from_date { const fc_Date &_date; from_date (const fc_Date &date) throw () : _date (date) {} // Operator to convert to type date. operator Type::Date () const throw () { Type::Date tem; return tem; } private: // Not implemented. from_date (); from_date (const from_date &); }; fc_Date aday() { return 1; } #ifdef BUG void foo() { fc_Date adate, bdate; Type::Date d = (aday () != 0 ? from_date (adate) : from_date (bdate)); } #else void foo() { fc_Date adate, bdate; Type::Date d; if (aday () != 0) d = from_date (adate); else d = from_date (bdate); } #endif >How-To-Repeat: Save the code above to file gccbug.cxx g++ -c -DBUG gccbug.cxx will fail to compile it g++ is 3.3 snapshot 20030326, with the message: gccbug.cxx: In function `void foo()': gccbug.cxx:23: error: `from_date::from_date(const from_date&)' is private gccbug.cxx:32: error: within this context gccbug.cxx:23: error: `from_date::from_date(const from_date&)' is private gccbug.cxx:32: error: within this context The -DBUG can be used to illustrate the bug in 3.3 snapshot. g++ 2.96, 3.0.4 and 3.2.2 all compile the example both with and without -DBUG. >Fix: >Release-Note: >Audit-Trail: >Unformatted: