public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46630] New: Front end issue
@ 2010-11-23 22:00 slarin at codeaurora dot org
  2010-11-23 22:10 ` [Bug c++/46630] " redi at gcc dot gnu.org
  2010-11-24 12:09 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: slarin at codeaurora dot org @ 2010-11-23 22:00 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Front end issue
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: slarin@codeaurora.org


The following C++ code: 


class C {
public:
    static int N;
    union U {
        int m;
        char k;
    };
    typedef void (*A[3])(int);
} c;

int C::N = 0;
int n = 0;

template <class T> struct S {
    void f(void) { (void) sizeof(typename T::N); }
};
S<C> s;
void g(void) { s.f(); }

Should compile fine per ISO/IEC 14882:2005, 14.6 (Name resolution). It fails
with plain vanilla x86 4.5.1 release:

g++ -v
Using built-in specs.
COLLECT_GCC=.../bin_x86/bin/g++
COLLECT_LTO_WRAPPER=.../bin_x86/libexec/gcc/x86_64-unknown-linux-gnu/4.5.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-threads=posix --prefix=.../bin_x86
--enable-languages=c,c++ --disable-checking
Thread model: posix
gcc version 4.5.1 (GCC)

(any option)

g++ -S test.C 
test.C: In member function 'void S<T>::f() [with T = C]':
test.C:56:   instantiated from here
test.C:53: error: no type named 'N' in 'class C'


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

* [Bug c++/46630] Front end issue
  2010-11-23 22:00 [Bug c++/46630] New: Front end issue slarin at codeaurora dot org
@ 2010-11-23 22:10 ` redi at gcc dot gnu.org
  2010-11-24 12:09 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2010-11-23 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-23 21:59:46 UTC ---
(In reply to comment #0)
> Should compile fine per ISO/IEC 14882:2005, 14.6 (Name resolution).

Why?  T::N is not a typename

ISO/IEC 14882:2003 14.6 paragraph 4 seems pretty clear to me:

If a specialization of a template is instantiated for a set of
template-arguments such that the qualified-id prefixed by typename does not
denote a type, the specialization is ill-formed.


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

* [Bug c++/46630] Front end issue
  2010-11-23 22:00 [Bug c++/46630] New: Front end issue slarin at codeaurora dot org
  2010-11-23 22:10 ` [Bug c++/46630] " redi at gcc dot gnu.org
@ 2010-11-24 12:09 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-24 12:09 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-24 12:03:36 UTC ---
EDG agrees with us:

t.C(15): error: member "C::N" is not a type name
      void f(void) { (void) sizeof(typename T::N); }
                                            ^
          detected during instantiation of "void S<T>::f() [with T=C]" at line
18

compilation aborted for t.C (code 2)


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

end of thread, other threads:[~2010-11-24 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-23 22:00 [Bug c++/46630] New: Front end issue slarin at codeaurora dot org
2010-11-23 22:10 ` [Bug c++/46630] " redi at gcc dot gnu.org
2010-11-24 12:09 ` rguenth 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).