Add -fdelayed-template-parsing option. Using this option all templated function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup.

Using this flag is necessary for compatibility with Microsoft template code.
This also provides some parsing speed improvement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130022 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Parser/DelayedTemplateParsing.cpp b/test/Parser/DelayedTemplateParsing.cpp
new file mode 100644
index 0000000..355250e
--- /dev/null
+++ b/test/Parser/DelayedTemplateParsing.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fdelayed-template-parsing -fsyntax-only -verify %s

+

+template <class T>

+class A {

+

+   void foo() {

+       undeclared();

+   }

+   

+   void foo2();

+};

+

+template <class T>

+void A<T>::foo2() {

+    undeclared();

+}

+

+

+template <class T>

+void foo3() {

+   undeclared();

+}

+

+template void A<int>::foo2();

+

+

+void undeclared()

+{

+

+}

+