public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49224] New: Scoped enumeration instantiated even if not required
@ 2011-05-29 15:14 schaub.johannes at googlemail dot com
  2021-08-05  9:59 ` [Bug c++/49224] [C++0x] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: schaub.johannes at googlemail dot com @ 2011-05-29 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Scoped enumeration instantiated even if not required
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schaub.johannes@googlemail.com


GCC should not instantiate the definition of the scoped enumeration:

template<typename T>
struct A {
  enum class B {
    X = T::value
  };
};

int main() {
  A<int> a;
}

GCC error:

main1.cpp: In instantiation of ‘A<int>’:
main1.cpp:9:10:   instantiated from here
main1.cpp:3:14: error: ‘value’ is not a member of ‘int’

This code looks well-formed. Only if we look into the enumeration, as
"A<int>::B::X", the definition of the enumeration is required to exist and thus
implicitly instantiated. This is specified at 14.7.1p1 and p2.


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

* [Bug c++/49224] [C++0x] Scoped enumeration instantiated even if not required
  2011-05-29 15:14 [Bug c++/49224] New: Scoped enumeration instantiated even if not required schaub.johannes at googlemail dot com
@ 2021-08-05  9:59 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-05  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zhonghao at pku dot org.cn

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 86183 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2021-08-05  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-29 15:14 [Bug c++/49224] New: Scoped enumeration instantiated even if not required schaub.johannes at googlemail dot com
2021-08-05  9:59 ` [Bug c++/49224] [C++0x] " pinskia 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).