public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode
@ 2012-08-02  2:41 ai.azuma at gmail dot com
  2012-08-02  9:42 ` [Bug c++/54158] [4.6, 4.7, 4.8 Regression] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ai.azuma at gmail dot com @ 2012-08-02  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54158
           Summary: Silently accepts sizeof to non-static member without
                    object in C++03 mode
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ai.azuma@gmail.com


The following code is not well-formed in C++03.

/////////////////////////////
struct Class
{
  int Member;
};

int i[sizeof(Class::Member)];
/////////////////////////////

However, GCC 4.6.4 20120727, 4.7.2 20120728 and 4.8.0 20120729 accept this code
without any warning, even with `-std=c++03', `-Wall' and `-pedantic'.


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

* [Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode
  2012-08-02  2:41 [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode ai.azuma at gmail dot com
@ 2012-08-02  9:42 ` redi at gcc dot gnu.org
  2012-08-02  9:45 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-02  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-08-02
      Known to work|                            |3.4.3, 4.1.2
            Summary|Silently accepts sizeof to  |[4.6, 4.7, 4.8 Regression]
                   |non-static member without   |Silently accepts sizeof to
                   |object in C++03 mode        |non-static member without
                   |                            |object in C++03 mode
     Ever Confirmed|0                           |1
      Known to fail|                            |4.4.3

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-02 09:42:07 UTC ---
Confirmed, 3.4 and 4.1 got this right:

t.cc:3: error: invalid use of non-static data member `Class::Member'
t.cc:6: error: from this location


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

* [Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode
  2012-08-02  2:41 [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode ai.azuma at gmail dot com
  2012-08-02  9:42 ` [Bug c++/54158] [4.6, 4.7, 4.8 Regression] " redi at gcc dot gnu.org
@ 2012-08-02  9:45 ` redi at gcc dot gnu.org
  2012-08-02 10:45 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-02  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-02 09:45:06 UTC ---
Ah, it was changed by a DR
(http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#613) not a C++11
proposal, so supporting it in C++03 mode is probably intentional.


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

* [Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode
  2012-08-02  2:41 [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode ai.azuma at gmail dot com
  2012-08-02  9:42 ` [Bug c++/54158] [4.6, 4.7, 4.8 Regression] " redi at gcc dot gnu.org
  2012-08-02  9:45 ` redi at gcc dot gnu.org
@ 2012-08-02 10:45 ` paolo.carlini at oracle dot com
  2012-08-02 10:51 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-02 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-02 10:45:09 UTC ---
Indeed, I have recollections of the resolution being implemented. Let's close
this. If I can quickly find a pointer I will add it here.


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

* [Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode
  2012-08-02  2:41 [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode ai.azuma at gmail dot com
                   ` (2 preceding siblings ...)
  2012-08-02 10:45 ` paolo.carlini at oracle dot com
@ 2012-08-02 10:51 ` paolo.carlini at oracle dot com
  2012-08-03  2:06 ` ai.azuma at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-02 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-02 10:51:32 UTC ---
2009-03-31  Jason Merrill  <jason@redhat.com>

    C++ DR 613
    * semantics.c (finish_non_static_data_member): Allow such references
    without an associated object in sizeof/decltype/alignof.


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

* [Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode
  2012-08-02  2:41 [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode ai.azuma at gmail dot com
                   ` (3 preceding siblings ...)
  2012-08-02 10:51 ` paolo.carlini at oracle dot com
@ 2012-08-03  2:06 ` ai.azuma at gmail dot com
  2012-08-03  7:57 ` redi at gcc dot gnu.org
  2012-08-03  8:21 ` ai.azuma at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: ai.azuma at gmail dot com @ 2012-08-03  2:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Ai Azuma <ai.azuma at gmail dot com> 2012-08-03 02:05:45 UTC ---
Well, I'm a bit confused. So I would like to make sure some points.

> Ah, it was changed by a DR
> (http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#613) not a C++11
> proposal, so supporting it in C++03 mode is probably intentional.

The proposed resolution for DRs on 03's wording with "Status: CD1" is not
considered as a part of C++11, right?

And GCC's `-std=c++03' intentionally includes such proposed resolutions, right?


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

* [Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode
  2012-08-02  2:41 [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode ai.azuma at gmail dot com
                   ` (4 preceding siblings ...)
  2012-08-03  2:06 ` ai.azuma at gmail dot com
@ 2012-08-03  7:57 ` redi at gcc dot gnu.org
  2012-08-03  8:21 ` ai.azuma at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-03  7:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-03 07:57:28 UTC ---
Right


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

* [Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode
  2012-08-02  2:41 [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode ai.azuma at gmail dot com
                   ` (5 preceding siblings ...)
  2012-08-03  7:57 ` redi at gcc dot gnu.org
@ 2012-08-03  8:21 ` ai.azuma at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: ai.azuma at gmail dot com @ 2012-08-03  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Ai Azuma <ai.azuma at gmail dot com> 2012-08-03 08:21:21 UTC ---
(In reply to comment #6)
> Right

O.K. Then, this behavior makes sense. Thanks for the clarification!


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

end of thread, other threads:[~2012-08-03  8:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-02  2:41 [Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode ai.azuma at gmail dot com
2012-08-02  9:42 ` [Bug c++/54158] [4.6, 4.7, 4.8 Regression] " redi at gcc dot gnu.org
2012-08-02  9:45 ` redi at gcc dot gnu.org
2012-08-02 10:45 ` paolo.carlini at oracle dot com
2012-08-02 10:51 ` paolo.carlini at oracle dot com
2012-08-03  2:06 ` ai.azuma at gmail dot com
2012-08-03  7:57 ` redi at gcc dot gnu.org
2012-08-03  8:21 ` ai.azuma at gmail 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).