Commit db10c6ec by Simon Martin Committed by Simon Martin

re PR c++/38089 (g++ crash on invalid code)

gcc/cp/

2009-06-02  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/38089
	* pt.c (register_specialization): Properly setup DECL_CONTEXT for
	specializations in an invalid namespace.

gcc/testsuite/

2009-06-02  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/38089
	* g++.dg/template/spec36.C: New test.

From-SVN: r148069
parent 0aa34d44
2009-06-02 Simon Martin <simartin@users.sourceforge.net>
PR c++/38089
* pt.c (register_specialization): Properly setup DECL_CONTEXT for
specializations in an invalid namespace.
2009-06-01 Aldy Hernandez <aldyh@redhat.com> 2009-06-01 Aldy Hernandez <aldyh@redhat.com>
* error.c (print_instantiation_partial_context): Print column * error.c (print_instantiation_partial_context): Print column
......
...@@ -1316,7 +1316,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend) ...@@ -1316,7 +1316,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
template it is specializing. */ template it is specializing. */
if (DECL_TEMPLATE_SPECIALIZATION (spec) if (DECL_TEMPLATE_SPECIALIZATION (spec)
&& !check_specialization_namespace (tmpl)) && !check_specialization_namespace (tmpl))
DECL_CONTEXT (spec) = FROB_CONTEXT (decl_namespace_context (tmpl)); DECL_CONTEXT (spec) = DECL_CONTEXT (tmpl);
if (!optimize_specialization_lookup_p (tmpl)) if (!optimize_specialization_lookup_p (tmpl))
DECL_TEMPLATE_SPECIALIZATIONS (tmpl) DECL_TEMPLATE_SPECIALIZATIONS (tmpl)
......
2009-06-02 Simon Martin <simartin@users.sourceforge.net>
PR c++/38089
* g++.dg/template/spec36.C: New test.
2009-06-01 Ian Lance Taylor <iant@google.com> 2009-06-01 Ian Lance Taylor <iant@google.com>
* gcc.dg/cast-qual-3.c: New testcase. * gcc.dg/cast-qual-3.c: New testcase.
......
/* PR c++/38089 */
/* { dg-do "compile" } */
struct basic_string
{
basic_string(const int __s);
};
namespace MyNS {
class MyClass {
template <typename T>
T test() { } /* { dg-error "from definition" } */
};
}
template <>
basic_string MyNS::MyClass::test() /* { dg-error "specialization of" } */
{ return 1; }
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