Instantiate function declarations in instantiated functions.

If a function declaration is found inside a template function as in:

    template<class T> void f() {
      void g(int x = T::v) except(T::w);
    }

it must be instantiated along with the enclosing template function,
including default arguments and exception specification.

Together with the patch committed in r240974 this implements DR1484.

Differential Revision: http://reviews.llvm.org/D11194

llvm-svn: 245810
diff --git a/clang/test/SemaTemplate/default-arguments.cpp b/clang/test/SemaTemplate/default-arguments.cpp
index 439a303..0e97252 100644
--- a/clang/test/SemaTemplate/default-arguments.cpp
+++ b/clang/test/SemaTemplate/default-arguments.cpp
@@ -159,3 +159,10 @@
 
   int g() { X<int>::f(0); } // expected-note {{in instantiation of template class 'DR1635::X<int>' requested here}}
 }
+
+namespace NondefDecls {
+  template<typename T> void f1() {
+    int g1(int defarg = T::error);  // expected-error{{type 'int' cannot be used prior to '::' because it has no members}}
+  }
+  template void f1<int>();  // expected-note{{in instantiation of function template specialization 'NondefDecls::f1<int>' requested here}}
+}