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++/12228] New: syntax error calling a qualified template dtor


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: syntax error calling a qualified template dtor
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org

The IMO well-formed program below fails to compile with g++ 3.3 (EDG 3.3 fails
to compile it as well due to a bug; IBM VisualAge C++ 6.0 compiles it fine). For
some discussion on the subject of pseudo-destructor calls see:

    http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#244
    http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#399

Regards
Martin

$ cat t.cpp && g++ -c t.cpp
/*   1 */ namespace N {
/*   2 */     struct A { typedef A NA; };
/*   3 */     template <class T> struct B { typedef B NB; typedef T BT; };
/*   4 */     template <template <class> class T> struct C { typedef C NC;
typedef T<A> CA; };
/*   5 */ }
/*   6 */ 
/*   7 */ void foo (N::A *p)
/*   8 */ {
/*   9 */     p->~NA ();
/*  10 */     p->NA::~NA ();
/*  11 */ }
/*  12 */ 
/*  13 */ template <class T>
/*  14 */ void foo (N::B<T> *p)
/*  15 */ {
/*  16 */     p->~NB ();
/*  17 */     p->NB::~NB ();
/*  18 */ }
/*  19 */ 
/*  20 */ template <class T>
/*  21 */ void foo (typename N::B<T>::BT *p)
/*  22 */ {
/*  23 */     p->~BT ();
/*  24 */     p->BT::~BT ();
/*  25 */ }
/*  26 */ 
/*  27 */ template <template <class> class T>
/*  28 */ void foo (N::C<T> *p)
/*  29 */ {
/*  30 */     p->~NC ();
/*  31 */     p->NC::~NC ();
/*  32 */ }
/*  33 */ 
/*  34 */ template <template <class> class T>
/*  35 */ void foo (typename N::C<T>::CA *p)
/*  36 */ {
/*  37 */     p->~CA ();
/*  38 */     p->CA::~CA ();
/*  39 */ }
/*  40 */ 
t.cpp: In function `void foo(N::B<T>*)':
t.cpp:17: error: parse error before `::' token
t.cpp: In function `void foo(typename N::B<T>::BT*)':
t.cpp:24: error: parse error before `::' token
t.cpp: In function `void foo(N::C<T>*)':
t.cpp:31: error: parse error before `::' token
t.cpp: In function `void foo(typename N::C<T>::CA*)':
t.cpp:38: error: parse error before `::' token


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