This is the mail archive of the gcc-patches@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]

C++ patch for c++/37563


In this bug, we tried to look inside Y:: even though it's a dependent type because we thought it was part of a declarator. But it isn't, and correcting that flag fixes the bug.

Tested x86_64-pc-linux-gnu, applied to trunk. I'll test and apply to 4.3 as appropriate.
2008-11-19  Jason Merrill  <jason@redhat.com>

	PR c++/37563
	* parser.c (cp_parser_pseudo_destructor_name): A pseudo-destructor
	name is not a declaration.
	* g++.dg/template/pseudodtor5.C: New test.

Index: cp/parser.c
===================================================================
*** cp/parser.c	(revision 142004)
--- cp/parser.c	(working copy)
*************** cp_parser_pseudo_destructor_name (cp_par
*** 5264,5270 ****
  					    /*typename_keyword_p=*/false,
  					    /*check_dependency_p=*/true,
  					    /*type_p=*/false,
! 					    /*is_declaration=*/true)
         != NULL_TREE);
    /* Now, if we saw a nested-name-specifier, we might be doing the
       second production.  */
--- 5264,5270 ----
  					    /*typename_keyword_p=*/false,
  					    /*check_dependency_p=*/true,
  					    /*type_p=*/false,
! 					    /*is_declaration=*/false)
         != NULL_TREE);
    /* Now, if we saw a nested-name-specifier, we might be doing the
       second production.  */
Index: testsuite/g++.dg/template/pseudodtor5.C
===================================================================
*** testsuite/g++.dg/template/pseudodtor5.C	(revision 0)
--- testsuite/g++.dg/template/pseudodtor5.C	(revision 0)
***************
*** 0 ****
--- 1,23 ----
+ // PR c++/37563
+ 
+ struct A {};
+ 
+ template<int> struct Traits
+ {
+   typedef void X;
+ };
+ 
+ template<> struct Traits<0>
+ {
+   typedef A X;
+ };
+ 
+ template<int N> struct B
+ {
+   typedef typename Traits<N>::X Y;
+ 
+   void foo(Y y)
+   {
+     y.Y::A::~A();
+   }
+ };

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