From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4443 invoked by alias); 26 Jan 2004 17:20:37 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4426 invoked by uid 48); 26 Jan 2004 17:20:35 -0000 Date: Mon, 26 Jan 2004 17:20:00 -0000 From: "joerg dot richter at pdv-fs dot de" To: gcc-bugs@gcc.gnu.org Message-ID: <20040126172022.13868.joerg.richter@pdv-fs.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/13868] New: Conditional expression operator and implicit char array conversion X-Bugzilla-Reason: CC X-SW-Source: 2004-01/txt/msg03291.txt.bz2 List-Id: Compile this program with GCC3.3.2: ---- struct Foo { typedef char type[4]; type mem; operator type&() { return mem; } }; int main() { true ? "ab" : Foo(); return 0; } ---- and you get the following output: a.cc:14: no match for `bool ? const char[5] : Foo' operator a.cc:14: candidates are: operator?:(bool, char*, char*) a.cc:14: operator?:(bool, const char*, const char*) I think this should compile. Using the user defined conversion to char (&) [4] and then the array to pointer conversion on both sides. Then the qualification conversion and you have the same types char const*. Removing the need for the array to pointer conversion, by changing "ab" to "abc" helps. Or removing the qualification conversion by changing the implicit conversion to "operator type const&()" helps also. -- Summary: Conditional expression operator and implicit char array conversion Product: gcc Version: 3.3.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: joerg dot richter at pdv-fs dot de CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13868