From 2f77200b3f168ebf0b07acd63d68096d8840fc1d Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 7 Oct 2014 10:26:50 +0200
Subject: [PATCH] pr63270.h: New test.

	* g++.dg/lto/pr63270.h: New test.
	* g++.dg/lto/pr63270_0.C (int main): Implementation replaced with
	include.
	* g++.dg/lto/pr63270_2.C: New test.

From-SVN: r215967
---
 gcc/testsuite/ChangeLog              |  7 +++
 gcc/testsuite/g++.dg/lto/pr63270.h   | 68 ++++++++++++++++++++++++++++
 gcc/testsuite/g++.dg/lto/pr63270_0.C | 65 +-------------------------
 gcc/testsuite/g++.dg/lto/pr63270_2.C |  8 ++++
 4 files changed, 84 insertions(+), 64 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/lto/pr63270.h
 create mode 100644 gcc/testsuite/g++.dg/lto/pr63270_2.C

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 21ca143c0b44..cc757a02406e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-07  Martin Liska  <mliska@suse.cz>
+
+	* g++.dg/lto/pr63270.h: New test.
+	* g++.dg/lto/pr63270_0.C (int main): Implementation replaced with
+	include.
+	* g++.dg/lto/pr63270_2.C: New test.
+
 2014-10-07  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* gnat.dg/lto16.adb: New test.
diff --git a/gcc/testsuite/g++.dg/lto/pr63270.h b/gcc/testsuite/g++.dg/lto/pr63270.h
new file mode 100644
index 000000000000..a0a0f58370c0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr63270.h
@@ -0,0 +1,68 @@
+typedef unsigned long uintptr_t;
+namespace v8 {
+class Extension;
+namespace internal {
+class A {
+public:
+  A(int) {};
+};
+class B {
+public:
+  B(int) {};
+};
+class Scanner;
+class FuncNameInferrer;
+template <typename Traits> class ParserBase : Traits {
+  class FunctionState;
+  bool parenthesized_function_;
+  typename Traits::Type::Scope *scope_;
+  FunctionState *function_state_;
+  v8::Extension *extension_;
+  FuncNameInferrer *fni_;
+  Scanner *scanner_;
+  uintptr_t stack_limit_;
+  bool stack_overflow_;
+  bool allow_lazy_;
+  bool allow_natives_syntax_;
+  bool allow_generators_;
+  bool allow_for_of_;
+  typename Traits::Type::Zone *zone_;
+};
+class PreParserScope;
+class F;
+class PreParserTraits {
+public:
+  struct Type {
+    typedef PreParserScope Scope;
+    typedef void Zone;
+  };
+
+private:
+  F *pre_parser_;
+};
+class F : ParserBase<PreParserTraits> {};
+class C {
+public:
+  struct Type {
+    typedef v8::internal::FuncNameInferrer Scope;
+    typedef int Zone;
+  };
+};
+class G : ParserBase<C> {
+public:
+  static int m_fn1();
+  static int test();
+  F reusable_preparser_;
+};
+class D {
+public:
+  D(int a) : function_(0), context_(0), nested_scope_chain_(0) { G::test(); }
+  B function_;
+  B context_;
+  A nested_scope_chain_;
+};
+}
+}
+
+
+
diff --git a/gcc/testsuite/g++.dg/lto/pr63270_0.C b/gcc/testsuite/g++.dg/lto/pr63270_0.C
index 98f27350d5a5..924b238499aa 100644
--- a/gcc/testsuite/g++.dg/lto/pr63270_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr63270_0.C
@@ -1,70 +1,7 @@
 // { dg-lto-do link }
 // { dg-lto-options {{-flto -O2 -Wno-odr}} }
-typedef unsigned long uintptr_t;
-namespace v8 {
-class Extension;
-namespace internal {
-class A {
-public:
-  A(int);
-};
-class B {
-public:
-  B(int);
-};
-class Scanner;
-class FuncNameInferrer;
-template <typename Traits> class ParserBase : Traits {
-  class FunctionState;
-  bool parenthesized_function_;
-  typename Traits::Type::Scope *scope_;
-  FunctionState *function_state_;
-  v8::Extension *extension_;
-  FuncNameInferrer *fni_;
-  Scanner *scanner_;
-  uintptr_t stack_limit_;
-  bool stack_overflow_;
-  bool allow_lazy_;
-  bool allow_natives_syntax_;
-  bool allow_generators_;
-  bool allow_for_of_;
-  typename Traits::Type::Zone *zone_;
-};
-class PreParserScope;
-class F;
-class PreParserTraits {
-public:
-  struct Type {
-    typedef PreParserScope Scope;
-    typedef void Zone;
-  };
 
-private:
-  F *pre_parser_;
-};
-class F : ParserBase<PreParserTraits> {};
-class C {
-public:
-  struct Type {
-    typedef v8::internal::FuncNameInferrer Scope;
-    typedef int Zone;
-  };
-};
-class G : ParserBase<C> {
-public:
-  static int m_fn1();
-  F reusable_preparser_;
-};
-class D {
-public:
-  D(int) : function_(0), context_(0), nested_scope_chain_(0) { G::m_fn1(); }
-  B function_;
-  B context_;
-  A nested_scope_chain_;
-};
-void fn1() { D(0); }
-}
-}
+#include "pr63270.h"
 
 int main()
 {
diff --git a/gcc/testsuite/g++.dg/lto/pr63270_2.C b/gcc/testsuite/g++.dg/lto/pr63270_2.C
new file mode 100644
index 000000000000..e45ae686028b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr63270_2.C
@@ -0,0 +1,8 @@
+// { dg-options "-fno-lto" }
+
+#include "pr63270.h"
+
+int v8::internal::G::test()
+{
+  return 2;
+}
-- 
GitLab