public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/49395] New: Non-class prvalues seem to have cv-qualification with GCC @ 2011-06-13 20:20 hstong at ca dot ibm.com 2011-06-22 20:38 ` [Bug c++/49395] " jason at gcc dot gnu.org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: hstong at ca dot ibm.com @ 2011-06-13 20:20 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49395 Summary: Non-class prvalues seem to have cv-qualification with GCC Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: hstong@ca.ibm.com CC: michaelw@ca.ibm.com Host: powerpc64-unknown-linux-gnu Target: powerpc64-unknown-linux-gnu C++03 subclause 3.10 [basic.lval] paragraph 9 says that "non-class rvalues always have cv-unqualified types". When compiling with GCC, some forms of expressions producing non-class rvalues still act as if they have cv-qualified type. The test case below is meant to compile clean. ### Self-contained source (a.cpp): volatile int foo(); struct A { volatile int i; }; typedef volatile int vi; volatile int i; const int& ir1 = foo(); const int& ir2 = A().i; // line 8 const int& ir3 = static_cast<volatile int>(i); const int& ir4 = vi(); // line 10 ### Compiler Invocation: g++-4.6.0 -c a.cpp -o a.o ### Compiler output: a.cpp:8:22: error: invalid initialization of reference of type 'const int&' from expression of type 'volatile int' a.cpp:10:21: error: invalid initialization of reference of type 'const int&' from expression of type 'vi' ### g++ -v output: Using built-in specs. Target: powerpc64-unknown-linux-gnu Configured with: ./configure --prefix=/data/gcc --program-suffix=-4.6.0 --disable-libssp --disable-libgcj --enable-version-specific-runtime-libs --with-cpu=default32 --enable-secureplt --with-long-double-128 --enable-shared --enable-__cxa_atexit --enable-threads=posix --enable-languages=c,c++,fortran --with-gmp=/usr/local Thread model: posix gcc version 4.6.0 (GCC) ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/49395] Non-class prvalues seem to have cv-qualification with GCC 2011-06-13 20:20 [Bug c++/49395] New: Non-class prvalues seem to have cv-qualification with GCC hstong at ca dot ibm.com @ 2011-06-22 20:38 ` jason at gcc dot gnu.org 2011-06-23 16:55 ` jason at gcc dot gnu.org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: jason at gcc dot gnu.org @ 2011-06-22 20:38 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49395 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2011.06.22 20:36:09 CC| |jason at gcc dot gnu.org AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-22 20:36:09 UTC --- I think line 10 is definitely a bug, line 8 may be a standards issue; I notice that EDG also complains about that line. Since A().i is a subobject of a class prvalue, we might want to treat it differently from a normal int prvalue. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/49395] Non-class prvalues seem to have cv-qualification with GCC 2011-06-13 20:20 [Bug c++/49395] New: Non-class prvalues seem to have cv-qualification with GCC hstong at ca dot ibm.com 2011-06-22 20:38 ` [Bug c++/49395] " jason at gcc dot gnu.org @ 2011-06-23 16:55 ` jason at gcc dot gnu.org 2011-06-23 17:10 ` jason at gcc dot gnu.org ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: jason at gcc dot gnu.org @ 2011-06-23 16:55 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49395 --- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-23 16:52:44 UTC --- Author: jason Date: Thu Jun 23 16:52:41 2011 New Revision: 175339 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175339 Log: PR c++/49395 * init.c (build_zero_init_1): Strip cv-quals from scalar types. Added: trunk/gcc/testsuite/g++.dg/init/ref18.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/init.c trunk/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/49395] Non-class prvalues seem to have cv-qualification with GCC 2011-06-13 20:20 [Bug c++/49395] New: Non-class prvalues seem to have cv-qualification with GCC hstong at ca dot ibm.com 2011-06-22 20:38 ` [Bug c++/49395] " jason at gcc dot gnu.org 2011-06-23 16:55 ` jason at gcc dot gnu.org @ 2011-06-23 17:10 ` jason at gcc dot gnu.org 2012-12-15 4:11 ` jason at gcc dot gnu.org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: jason at gcc dot gnu.org @ 2011-06-23 17:10 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49395 --- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-23 17:09:18 UTC --- Fixed line 10. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/49395] Non-class prvalues seem to have cv-qualification with GCC 2011-06-13 20:20 [Bug c++/49395] New: Non-class prvalues seem to have cv-qualification with GCC hstong at ca dot ibm.com ` (2 preceding siblings ...) 2011-06-23 17:10 ` jason at gcc dot gnu.org @ 2012-12-15 4:11 ` jason at gcc dot gnu.org 2024-04-04 6:06 ` pinskia at gcc dot gnu.org 2024-04-05 4:54 ` hstong at ca dot ibm.com 5 siblings, 0 replies; 7+ messages in thread From: jason at gcc dot gnu.org @ 2012-12-15 4:11 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49395 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |SUSPENDED AssignedTo|jason at gcc dot gnu.org |unassigned at gcc dot | |gnu.org ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/49395] Non-class prvalues seem to have cv-qualification with GCC 2011-06-13 20:20 [Bug c++/49395] New: Non-class prvalues seem to have cv-qualification with GCC hstong at ca dot ibm.com ` (3 preceding siblings ...) 2012-12-15 4:11 ` jason at gcc dot gnu.org @ 2024-04-04 6:06 ` pinskia at gcc dot gnu.org 2024-04-05 4:54 ` hstong at ca dot ibm.com 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-04-04 6:06 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49395 --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- line 8 is rejected by clang and MSVC also. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/49395] Non-class prvalues seem to have cv-qualification with GCC 2011-06-13 20:20 [Bug c++/49395] New: Non-class prvalues seem to have cv-qualification with GCC hstong at ca dot ibm.com ` (4 preceding siblings ...) 2024-04-04 6:06 ` pinskia at gcc dot gnu.org @ 2024-04-05 4:54 ` hstong at ca dot ibm.com 5 siblings, 0 replies; 7+ messages in thread From: hstong at ca dot ibm.com @ 2024-04-05 4:54 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49395 Hubert Tong <hstong at ca dot ibm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|SUSPENDED |RESOLVED Resolution|--- |FIXED --- Comment #6 from Hubert Tong <hstong at ca dot ibm.com> --- A().i on line 8 is specified to be an xvalue of type "volatile int" nowadays. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-05 4:54 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-06-13 20:20 [Bug c++/49395] New: Non-class prvalues seem to have cv-qualification with GCC hstong at ca dot ibm.com 2011-06-22 20:38 ` [Bug c++/49395] " jason at gcc dot gnu.org 2011-06-23 16:55 ` jason at gcc dot gnu.org 2011-06-23 17:10 ` jason at gcc dot gnu.org 2012-12-15 4:11 ` jason at gcc dot gnu.org 2024-04-04 6:06 ` pinskia at gcc dot gnu.org 2024-04-05 4:54 ` hstong at ca dot ibm.com
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).