/* APPLE LOCAL file radar 4439126 */
/* Test to see if instantiation occurs before meta-data is generated. */
/* { dg-do run { target powerpc*-*-darwin* i?86*-*-darwin* } } */
/* { dg-options "-framework Cocoa" } */
#import <Foundation/Foundation.h>

class Base
{
public:
	Base() { }
	virtual ~Base() { }
	
	void destroy() { delete this; }
};

template<class T>
class Subclass : public T
{
public:
	Subclass() { }
	
	virtual ~Subclass()
	{
		[[NSNotificationCenter defaultCenter] removeObserver: nil];
	}
};

int main(int argc, const char * argv[])
{
    Subclass<Base>* theSubclass = new Subclass<Base>();
    theSubclass->destroy(); // THIS WILL NOT COMPILE
    return 0;
}
