public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "istvan at benedek-home dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/30925] New: c++ frontend error: ?-operator parameter binding Date: Thu, 22 Feb 2007 11:10:00 -0000 [thread overview] Message-ID: <bug-30925-14144@http.gcc.gnu.org/bugzilla/> (raw) When trying to compile test.cpp: ' namespace { struct A { A() {} explicit A(short i) :m_value(i) {} A& operator = (short i) { m_value = i; return *this; } operator short& () { return m_value; } operator short () const { return m_value; } private: short m_value; }; const A CONSTA(-1); struct M { void set(A& value) const { value = 1 ? m_a : CONSTA; } short m_a; }; } int main(int argc, char** argv) { return 0; } ' test.cpp: In member function 'void<unnamed>::M::set(<unnamed>::A&) const': test.cpp:28: error: passing 'const<unnamed>::A' as 'this' argument of '<unnamed>::A::operator short int&()' discards qualifiers expected: convert const A to short and proceed. Build/Plattform/Version/Config info, as requested: Using built-in specs. Target: sparc-sun-solaris2.9 Configured with: ../gcc-4.1.1/configure --prefix=/opt/gnu//gcc-4.1.1 --enable-languages=c,c++ --with-ld=/opt/gnu//bin/ld --with-as=/opt/gnu//bin/as Thread model: posix gcc version 4.1.1 /opt/gnu/gcc-4.1.1/bin/../libexec/gcc/sparc-sun-solaris2.9/4.1.1/cc1plus -E -quiet -v -iprefix /opt/gnu/gcc-4.1.1/bin/../lib/gcc/sparc-sun-solaris2.9/4.1.1/ test.cpp -mcpu=v7 -fpch-preprocess -o test.ii ignoring nonexistent directory "/opt/gnu/gcc-4.1.1/bin/../lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../sparc-sun-solaris2.9/include" ignoring duplicate directory "/opt/gnu//gcc-4.1.1/lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../include/c++/4.1.1" ignoring duplicate directory "/opt/gnu//gcc-4.1.1/lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../include/c++/4.1.1/sparc-sun-solaris2.9" ignoring duplicate directory "/opt/gnu//gcc-4.1.1/lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../include/c++/4.1.1/backward" ignoring duplicate directory "/opt/gnu//gcc-4.1.1/lib/gcc/sparc-sun-solaris2.9/4.1.1/include" ignoring nonexistent directory "/opt/gnu//gcc-4.1.1/lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../sparc-sun-solaris2.9/include" #include "..." search starts here: #include <...> search starts here: /opt/gnu/gcc-4.1.1/bin/../lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../include/c++/4.1.1 /opt/gnu/gcc-4.1.1/bin/../lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../include/c++/4.1.1/sparc-sun-solaris2.9 /opt/gnu/gcc-4.1.1/bin/../lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../include/c++/4.1.1/backward /opt/gnu/gcc-4.1.1/bin/../lib/gcc/sparc-sun-solaris2.9/4.1.1/include /usr/local/include /opt/gnu//gcc-4.1.1/include /usr/include End of search list. /opt/gnu/gcc-4.1.1/bin/../libexec/gcc/sparc-sun-solaris2.9/4.1.1/cc1plus -fpreprocessed test.ii -quiet -dumpbase test.cpp -mcpu=v7 -auxbase test -version -o test.s GNU C++ version 4.1.1 (sparc-sun-solaris2.9) compiled by GNU C version 4.1.1. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 3f2c8f59f6f5b35c02abcffa8ee26357 test.cpp: In member function 'void<unnamed>::M::set(<unnamed>::F&) const': test.cpp:28: error: passing 'const<unnamed>::A' as 'this' argument of '<unnamed>::A::operator short int&()' discards qualifiers -- Summary: c++ frontend error: ?-operator parameter binding Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: istvan at benedek-home dot de GCC build triplet: sparc-sun-solaris2.9 GCC host triplet: sparc-sun-solaris2.9 GCC target triplet: sparc-sun-solaris2.9 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30925
next reply other threads:[~2007-02-22 11:10 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-02-22 11:10 istvan at benedek-home dot de [this message] 2007-02-22 23:37 ` [Bug c++/30925] " pinskia at gcc dot gnu dot org 2007-02-26 14:52 ` istvan at benedek-home dot de 2007-03-09 4:34 ` 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=bug-30925-14144@http.gcc.gnu.org/bugzilla/ \ --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).