public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66243] New: enum class value is allowed to be initialized by value from other enum class
@ 2015-05-21 13:27 Predelnik at gmail dot com
  2015-05-21 14:22 ` [Bug c++/66243] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Predelnik at gmail dot com @ 2015-05-21 13:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66243

            Bug ID: 66243
           Summary: enum class value is allowed to be initialized by value
                    from other enum class
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Predelnik at gmail dot com
  Target Milestone: ---

>From my understanding enum class values could be initialized by integer
constant expression (and thus by its own already defined values since they are
implicitly convertible to int in its scope). However g++ compiles the following
code where this value is taken from other completely unrelated enum class and
thus shouldn't be implicitly convertible to integer type in its scope.

enum class A
{
  X
};

enum class B
{
  X = A::X,
};

int main()
{
}


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

* [Bug c++/66243] enum class value is allowed to be initialized by value from other enum class
  2015-05-21 13:27 [Bug c++/66243] New: enum class value is allowed to be initialized by value from other enum class Predelnik at gmail dot com
@ 2015-05-21 14:22 ` redi at gcc dot gnu.org
  2015-05-21 22:36 ` nathan at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-05-21 14:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66243

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-05-21
     Ever confirmed|0                           |1


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

* [Bug c++/66243] enum class value is allowed to be initialized by value from other enum class
  2015-05-21 13:27 [Bug c++/66243] New: enum class value is allowed to be initialized by value from other enum class Predelnik at gmail dot com
  2015-05-21 14:22 ` [Bug c++/66243] " redi at gcc dot gnu.org
@ 2015-05-21 22:36 ` nathan at gcc dot gnu.org
  2015-05-24 23:18 ` nathan at gcc dot gnu.org
  2015-05-24 23:22 ` nathan at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2015-05-21 22:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66243

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |nathan at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |nathan at gcc dot gnu.org


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

* [Bug c++/66243] enum class value is allowed to be initialized by value from other enum class
  2015-05-21 13:27 [Bug c++/66243] New: enum class value is allowed to be initialized by value from other enum class Predelnik at gmail dot com
  2015-05-21 14:22 ` [Bug c++/66243] " redi at gcc dot gnu.org
  2015-05-21 22:36 ` nathan at gcc dot gnu.org
@ 2015-05-24 23:18 ` nathan at gcc dot gnu.org
  2015-05-24 23:22 ` nathan at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2015-05-24 23:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66243

--- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Author: nathan
Date: Sun May 24 23:17:58 2015
New Revision: 223636

URL: https://gcc.gnu.org/viewcvs?rev=223636&root=gcc&view=rev
Log:
        cp/
        PR c++/66243
        * decl.c (build_enumerator): Don't silently convert scoped enums.

        testsuite/
        PR c++/66243
        * g++.dg/cpp0x/pr66243.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr66243.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/66243] enum class value is allowed to be initialized by value from other enum class
  2015-05-21 13:27 [Bug c++/66243] New: enum class value is allowed to be initialized by value from other enum class Predelnik at gmail dot com
                   ` (2 preceding siblings ...)
  2015-05-24 23:18 ` nathan at gcc dot gnu.org
@ 2015-05-24 23:22 ` nathan at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2015-05-24 23:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66243

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #3 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
committed obvious patch


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

end of thread, other threads:[~2015-05-24 23:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-21 13:27 [Bug c++/66243] New: enum class value is allowed to be initialized by value from other enum class Predelnik at gmail dot com
2015-05-21 14:22 ` [Bug c++/66243] " redi at gcc dot gnu.org
2015-05-21 22:36 ` nathan at gcc dot gnu.org
2015-05-24 23:18 ` nathan at gcc dot gnu.org
2015-05-24 23:22 ` nathan at gcc dot gnu.org

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).