public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48940] New: GCC fails to issue expected error
@ 2011-05-10  2:00 vanceza at gmail dot com
  2011-05-10  9:27 ` [Bug c++/48940] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vanceza at gmail dot com @ 2011-05-10  2:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48940

           Summary: GCC fails to issue expected error
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vanceza@gmail.com


Created attachment 24217
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24217
Test case which should not compile

The expected error with the attached test case should be:

test.cpp: In function ‘int main()’:
test.cpp:18: error: ‘B::B(const B&)’ is private
test.cpp:24: error: within this context

This is issued by versions around 4.2 (not specifically noted; I only have the
mac version of 4.2, and while I had someone verify on another machine I don't
have their exact version info).  However, in GCC 4.4.5, the file instead
compiles, which is correct for the new C++0x standard, but incorrect in C++98.
------------------------------------------------------------------------------
g++ -v -save-temp -std=c++98 test.cpp
Using built-in specs.
g++-4.4.real: unrecognized option '-save-temp'
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic
--enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu
--target=i686-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5) 
COLLECT_GCC_OPTIONS='-v' '-save-temp' '-std=c++98' '-shared-libgcc'
'-mtune=generic' '-march=i686'
 /usr/lib/gcc/i686-linux-gnu/4.4.5/cc1plus -quiet -v -D_GNU_SOURCE test.cpp
-D_FORTIFY_SOURCE=2 -quiet -dumpbase test.cpp -mtune=generic -march=i686
-auxbase test -std=c++98 -version -fstack-protector -o /tmp/ccxISrDQ.s
ignoring nonexistent directory "/usr/local/include/i686-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../i686-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.4
 /usr/include/c++/4.4/i686-linux-gnu
 /usr/include/c++/4.4/backward
 /usr/local/include
 /usr/lib/gcc/i686-linux-gnu/4.4.5/include
 /usr/lib/gcc/i686-linux-gnu/4.4.5/include-fixed
 /usr/include/i686-linux-gnu
 /usr/include
End of search list.
GNU C++ (Ubuntu/Linaro 4.4.4-14ubuntu5) version 4.4.5 (i686-linux-gnu)
    compiled by GNU C version 4.4.5, GMP version 4.3.2, MPFR version 3.0.0-p3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1fe36891f4a5f71e4a498e712867261c
COLLECT_GCC_OPTIONS='-v' '-save-temp' '-std=c++98' '-shared-libgcc'
'-mtune=generic' '-march=i686'
 as -V -Qy -o /tmp/ccxHGSfp.o /tmp/ccxISrDQ.s
GNU assembler version 2.20.51 (i686-linux-gnu) using BFD version (GNU Binutils
for Ubuntu) 2.20.51-system.20100908
COMPILER_PATH=/usr/lib/gcc/i686-linux-gnu/4.4.5/:/usr/lib/gcc/i686-linux-gnu/4.4.5/:/usr/lib/gcc/i686-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/4.4.5/:/usr/lib/gcc/i686-linux-gnu/:/usr/lib/gcc/i686-linux-gnu/4.4.5/:/usr/lib/gcc/i686-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/i686-linux-gnu/4.4.5/:/usr/lib/gcc/i686-linux-gnu/4.4.5/:/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../:/lib/:/usr/lib/:/usr/lib/i686-linux-gnu/
COLLECT_GCC_OPTIONS='-v' '-save-temp' '-std=c++98' '-shared-libgcc'
'-mtune=generic' '-march=i686'
 /usr/lib/gcc/i686-linux-gnu/4.4.5/collect2 --build-id --eh-frame-hdr -m
elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -z relro
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crt1.o
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crti.o
/usr/lib/gcc/i686-linux-gnu/4.4.5/crtbegin.o
-L/usr/lib/gcc/i686-linux-gnu/4.4.5 -L/usr/lib/gcc/i686-linux-gnu/4.4.5
-L/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.4.5/../../..
-L/usr/lib/i686-linux-gnu /tmp/ccxHGSfp.o -lstdc++ -lm -lgcc_s -lgcc -lc
-lgcc_s -lgcc /usr/lib/gcc/i686-linux-gnu/4.4.5/crtend.o
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crtn.o


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48940] GCC fails to issue expected error
  2011-05-10  2:00 [Bug c++/48940] New: GCC fails to issue expected error vanceza at gmail dot com
@ 2011-05-10  9:27 ` redi at gcc dot gnu.org
  2011-05-10  9:52 ` vanceza at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-10  9:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48940

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-10 09:08:39 UTC ---
I assume you're talking about binding the A& to a B object without an
accessible copy constructor?
That was the subject of a Defect Report against C++03 so has been fixed in G++,
therefore not a bug.

No temporary is created, so no copy constructor is needed

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#589


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48940] GCC fails to issue expected error
  2011-05-10  2:00 [Bug c++/48940] New: GCC fails to issue expected error vanceza at gmail dot com
  2011-05-10  9:27 ` [Bug c++/48940] " redi at gcc dot gnu.org
@ 2011-05-10  9:52 ` vanceza at gmail dot com
  2011-05-10 10:18 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vanceza at gmail dot com @ 2011-05-10  9:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48940

--- Comment #2 from Zachary Vance <vanceza at gmail dot com> 2011-05-10 09:48:47 UTC ---
Sorry to be cryptic as to the part of the standard I was talking about.  Yes, I
was referring to report 391/589.

Yes, I agree that g++ should not issue an error for this file running in C++03
mode.

What I am filing a bug about is that g++ used to issue an error running in
C++98 mode, and now g++ does not issue an error running in C++98 mode.  I claim
that it should issue an error, because I understood issue the defect reports
only to affect the C++03 standardization.  Is this correct?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48940] GCC fails to issue expected error
  2011-05-10  2:00 [Bug c++/48940] New: GCC fails to issue expected error vanceza at gmail dot com
  2011-05-10  9:27 ` [Bug c++/48940] " redi at gcc dot gnu.org
  2011-05-10  9:52 ` vanceza at gmail dot com
@ 2011-05-10 10:18 ` redi at gcc dot gnu.org
  2011-05-10 10:38 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-10 10:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48940

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-10 10:07:53 UTC ---
(In reply to comment #2)
> Sorry to be cryptic as to the part of the standard I was talking about.  Yes, I
> was referring to report 391/589.
> 
> Yes, I agree that g++ should not issue an error for this file running in C++03
> mode.

(I assume you mean C++0x here)

DR 391 was resolved in 2005 and G++'s behaviour was changed intentionally, see
PR 25950

> What I am filing a bug about is that g++ used to issue an error running in
> C++98 mode, and now g++ does not issue an error running in C++98 mode.  I claim
> that it should issue an error, because I understood issue the defect reports
> only to affect the C++03 standardization.  Is this correct?

Technically yes, but the intent of the committee is that it should work, and
implementing that is more useful for users.  Does it actually serve any
advantage to reject the code, other than strict conformance?  With extended
SFINAE in C++0x you could make use of it, but the code is valid in C++0x, and
extended SFINAE isn't part of C++98.

There are lots of DRs that G++ implements, counter to the exact wording in
C++98 or C++03.

Jason, as the author of the fix for PR 25950, do you have an opinion?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48940] GCC fails to issue expected error
  2011-05-10  2:00 [Bug c++/48940] New: GCC fails to issue expected error vanceza at gmail dot com
                   ` (2 preceding siblings ...)
  2011-05-10 10:18 ` redi at gcc dot gnu.org
@ 2011-05-10 10:38 ` jakub at gcc dot gnu.org
  2011-05-10 11:03 ` vanceza at gmail dot com
  2011-10-21 16:37 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-10 10:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48940

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-10 10:07:16 UTC ---
No, -std=c++98 and -std=c++03 are aliases, both described as:
Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48940] GCC fails to issue expected error
  2011-05-10  2:00 [Bug c++/48940] New: GCC fails to issue expected error vanceza at gmail dot com
                   ` (3 preceding siblings ...)
  2011-05-10 10:38 ` jakub at gcc dot gnu.org
@ 2011-05-10 11:03 ` vanceza at gmail dot com
  2011-10-21 16:37 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: vanceza at gmail dot com @ 2011-05-10 11:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48940

--- Comment #5 from Zachary Vance <vanceza at gmail dot com> 2011-05-10 10:27:08 UTC ---
As long as folks are aware of this behavior and consider it proper, I
personally have no objection.  I don't see any large benefit from changing it;
I was just confused when other people couldn't reproduce the error my compiler
was giving.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48940] GCC fails to issue expected error
  2011-05-10  2:00 [Bug c++/48940] New: GCC fails to issue expected error vanceza at gmail dot com
                   ` (4 preceding siblings ...)
  2011-05-10 11:03 ` vanceza at gmail dot com
@ 2011-10-21 16:37 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-21 16:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48940

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-21 16:37:16 UTC ---
I think we can close this.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-21 16:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-10  2:00 [Bug c++/48940] New: GCC fails to issue expected error vanceza at gmail dot com
2011-05-10  9:27 ` [Bug c++/48940] " redi at gcc dot gnu.org
2011-05-10  9:52 ` vanceza at gmail dot com
2011-05-10 10:18 ` redi at gcc dot gnu.org
2011-05-10 10:38 ` jakub at gcc dot gnu.org
2011-05-10 11:03 ` vanceza at gmail dot com
2011-10-21 16:37 ` paolo.carlini at oracle dot 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).