public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "joerg dot richter at pdv-fs dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/13868] New: Conditional expression operator and implicit char array conversion Date: Mon, 26 Jan 2004 17:20:00 -0000 [thread overview] Message-ID: <20040126172022.13868.joerg.richter@pdv-fs.de> (raw) 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*) <built-in> a.cc:14: operator?:(bool, const char*, const char*) <built-in> 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
next reply other threads:[~2004-01-26 17:20 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-01-26 17:20 joerg dot richter at pdv-fs dot de [this message] 2004-01-26 17:31 ` [Bug c++/13868] " pinskia at gcc dot gnu dot org 2004-01-26 17:59 ` bangerth at dealii dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040126172022.13868.joerg.richter@pdv-fs.de \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).