public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51912] New: [C++11] G++ accepts floating point case labels
@ 2012-01-20  7:46 jason at gcc dot gnu.org
  2012-02-15 16:21 ` [Bug c++/51912] " paolo.carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-20  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51912
           Summary: [C++11] G++ accepts floating point case labels
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jason@gcc.gnu.org


5.19:  A converted constant expression of type T is a literal constant
expression, implicitly converted to type T, where the implicit conversion (if
any) is permitted in a literal constant expression and the implicit conversion
sequence contains only user-defined  conversions, lvalue-to-rvalue conversions
(4.1), integral promotions (4.5), and integral conversions (4.7) other than
narrowing conversions (8.5.4). [ Note: such expressions may be used as case
expressions (6.4.2), ....

So a floating point literal is not a valid case expression, since converting it
to the switch type would require a non-integral conversion.

void f(int i)
{
  switch (i)
    {
    case 1.0:;
    }
}


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

* [Bug c++/51912] [C++11] G++ accepts floating point case labels
  2012-01-20  7:46 [Bug c++/51912] New: [C++11] G++ accepts floating point case labels jason at gcc dot gnu.org
@ 2012-02-15 16:21 ` paolo.carlini at oracle dot com
  2012-02-15 16:41 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-02-15 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-02-15
     Ever Confirmed|0                           |1


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

* [Bug c++/51912] [C++11] G++ accepts floating point case labels
  2012-01-20  7:46 [Bug c++/51912] New: [C++11] G++ accepts floating point case labels jason at gcc dot gnu.org
  2012-02-15 16:21 ` [Bug c++/51912] " paolo.carlini at oracle dot com
@ 2012-02-15 16:41 ` paolo.carlini at oracle dot com
  2012-05-29 14:02 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-02-15 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-02-15 16:20:55 UTC ---
*** Bug 52257 has been marked as a duplicate of this bug. ***


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

* [Bug c++/51912] [C++11] G++ accepts floating point case labels
  2012-01-20  7:46 [Bug c++/51912] New: [C++11] G++ accepts floating point case labels jason at gcc dot gnu.org
  2012-02-15 16:21 ` [Bug c++/51912] " paolo.carlini at oracle dot com
  2012-02-15 16:41 ` paolo.carlini at oracle dot com
@ 2012-05-29 14:02 ` paolo.carlini at oracle dot com
  2013-08-14 18:01 ` paolo.carlini at oracle dot com
  2013-08-14 21:44 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-29 14:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot
                   |                            |com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-29 13:58:21 UTC ---
Jason, I'm thinking that this should be doable rather easily by adding a new
LOOKUP_NO_NON_INTEGRAL mask and passing it down to standard_conversion from 
case_conversion via perform_implicit_conversion_flags.

Then standard_conversion can exclude all such non-integral conversions, eg, for
this specific testcase, return NULL from line #1332 because fcode == REALTYPE
&& (flags & LOOKUP_NO_NON_INTEGRAL)).

Makes sense?


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

* [Bug c++/51912] [C++11] G++ accepts floating point case labels
  2012-01-20  7:46 [Bug c++/51912] New: [C++11] G++ accepts floating point case labels jason at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-05-29 14:02 ` paolo.carlini at oracle dot com
@ 2013-08-14 18:01 ` paolo.carlini at oracle dot com
  2013-08-14 21:44 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-14 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|paolo.carlini at oracle dot com    |
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/51912] [C++11] G++ accepts floating point case labels
  2012-01-20  7:46 [Bug c++/51912] New: [C++11] G++ accepts floating point case labels jason at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-08-14 18:01 ` paolo.carlini at oracle dot com
@ 2013-08-14 21:44 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-14 21:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.


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

end of thread, other threads:[~2013-08-14 21:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-20  7:46 [Bug c++/51912] New: [C++11] G++ accepts floating point case labels jason at gcc dot gnu.org
2012-02-15 16:21 ` [Bug c++/51912] " paolo.carlini at oracle dot com
2012-02-15 16:41 ` paolo.carlini at oracle dot com
2012-05-29 14:02 ` paolo.carlini at oracle dot com
2013-08-14 18:01 ` paolo.carlini at oracle dot com
2013-08-14 21:44 ` 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).