Commit 72b75d03 by H.J. Lu

re PR c++/28301 (ICE with broken specialization)

gcc/cp/

2009-04-10  Jason Merrill  <jason@redhat.com>

	PR c++/28301
	* parser.c (cp_parser_skip_to_end_of_block_or_statement): Return
	if we see a close brace without an open brace.

gcc/testsuite/

2009-04-10  H.J. Lu  <hongjiu.lu@intel.com>

	PR c++/28301
	* g++.dg/cpp0x/enum2.C: Updated.
	* g++.dg/debug/pr22514.C: Likewise.
	* g++.dg/parse/enum2.C: Likewise.
	* g++.dg/parse/enum3.C: Likewise.
	* g++.dg/template/crash79.C: Likewise.
	* g++.old-deja/g++.jason/cond.C: Likewise.

	* g++.dg/template/pr28301.C: New.

From-SVN: r145936
parent 6e990b54
2009-04-10 Jason Merrill <jason@redhat.com>
PR c++/28301
* parser.c (cp_parser_skip_to_end_of_block_or_statement): Return
if we see a close brace without an open brace.
2008-04-10 H.J. Lu <hongjiu.lu@intel.com> 2008-04-10 H.J. Lu <hongjiu.lu@intel.com>
* parser.c (cp_parser_class_specifier): Remove the unused * parser.c (cp_parser_class_specifier): Remove the unused
......
...@@ -2623,6 +2623,8 @@ cp_parser_skip_to_end_of_block_or_statement (cp_parser* parser) ...@@ -2623,6 +2623,8 @@ cp_parser_skip_to_end_of_block_or_statement (cp_parser* parser)
/* Stop if this is an unnested '}', or closes the outermost /* Stop if this is an unnested '}', or closes the outermost
nesting level. */ nesting level. */
nesting_depth--; nesting_depth--;
if (nesting_depth < 0)
return;
if (!nesting_depth) if (!nesting_depth)
nesting_depth = -1; nesting_depth = -1;
break; break;
......
2009-04-10 H.J. Lu <hongjiu.lu@intel.com>
PR c++/28301
* g++.dg/cpp0x/enum2.C: Updated.
* g++.dg/debug/pr22514.C: Likewise.
* g++.dg/parse/enum2.C: Likewise.
* g++.dg/parse/enum3.C: Likewise.
* g++.dg/template/crash79.C: Likewise.
* g++.old-deja/g++.jason/cond.C: Likewise.
2009-04-10 Chao-ying Fu <fu@mips.com> 2009-04-10 Chao-ying Fu <fu@mips.com>
* gcc.target/mips/interrupt_handler.c: Change from compile to * gcc.target/mips/interrupt_handler.c: Change from compile to
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=c++0x" } // { dg-options "-std=c++0x" }
template<int> enum E : int { e }; // { dg-error "template declaration of" } template<int> enum E : int { e }; // { dg-error "declaration|expected" }
...@@ -10,4 +10,4 @@ namespace s ...@@ -10,4 +10,4 @@ namespace s
using _List_base<i>::_M_impl; using _List_base<i>::_M_impl;
} }
} /* { dg-error "expected unqualified-id before '\}'" } */ } /* { dg-error "expected unqualified-id before '\}'" } */
s::list<1> OutputModuleListType; /* { dg-error "expected" } */ s::list<1> OutputModuleListType;
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
// PR c++/18123: ICE pushing tag from invalid template. // PR c++/18123: ICE pushing tag from invalid template.
template<int> enum E { e }; // { dg-error "template declaration" } template<int> enum E { e }; // { dg-error "declaration|expected" }
// PR c++/28261 // PR c++/28261
struct A {}; // { dg-error "A" } struct A {};
A::A (enum { e }) {} // { dg-error "defined|match" } A::A (enum { e }) {} // { dg-error "defined|token" }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
struct A struct A
{ {
A(int); A(int);
template<int> enum { e }; // { dg-error "template" } template<int> enum { e }; // { dg-error "template|expected" }
}; }; // { dg-error "expected" }
A a(A::e); // { dg-error "not a member" } A a(A::e);
// PR c++/28301
// { dg-do compile }
template<typename> struct A
{
template<int> void foo()
}; // { dg-error "initializer" }
template<> struct A<void>
{
template<int> void foo();
};
void bar()
{
A<void> a;
a.foo<0>();
}
...@@ -40,7 +40,7 @@ int main() ...@@ -40,7 +40,7 @@ int main()
// { dg-error "expected" "exp" { target *-*-* } 39 } // { dg-error "expected" "exp" { target *-*-* } 39 }
if (enum A { one, two, three } foo = one) // { dg-error "defined" "def" } if (enum A { one, two, three } foo = one) // { dg-error "defined" "def" }
// { dg-error "declared" "decl" { target *-*-* } 42 } // { dg-error "expected" "expected" { target *-*-* } 42 }
; ;
struct B { operator int () { return 2; } }; struct B { operator int () { return 2; } };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment