This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71664] New: valid C++11 code with qualified enumerator lookup rejected


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

            Bug ID: 71664
           Summary: valid C++11 code with qualified enumerator lookup
                    rejected
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following C++11 code is rejected when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.  

It also affects older versions at least as early as 4.6.x. 

This is related to and derived from PR 71662. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160625 (experimental) [trunk revision 237780] (GCC) 
$ 
$ clang++-3.8 -c -std=c++11 small.cpp
$ 
$ g++-trunk -c -std=c++11 small.cpp
small.cpp: In instantiation of âA<T>::E A<T>::h() [with T = int]â:
small.cpp:8:23:   required from here
small.cpp:14:22: error: âeâ is not a member of âA<int>::Eâ
   return A < T >::E::e;
                      ^
$ 


--------------------------------------------------------------


template < typename T > struct A
{
  enum E : T;
  E h ();
};

A < int > a;
A < int >::E b = a.h ();

template < typename T > enum A < T >::E : T { e };

template < typename T > typename A < T >::E A < T >::h ()
{
  return A < T >::E::e;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]