diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-04-22 22:18:13 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-04-22 22:18:13 +0000 |
commit | 1c229c0472edfd59ce61ba063a93517df609ceb4 (patch) | |
tree | 1e04ded322353a75ad11c8a4abc2062bda412992 /clang/test/Parser/DelayedTemplateParsing.cpp | |
parent | 91956aba03217e41b7664cdfc575907593067f39 (diff) | |
download | bcm5719-llvm-1c229c0472edfd59ce61ba063a93517df609ceb4.tar.gz bcm5719-llvm-1c229c0472edfd59ce61ba063a93517df609ceb4.zip |
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.
llvm-svn: 130022
Diffstat (limited to 'clang/test/Parser/DelayedTemplateParsing.cpp')
-rw-r--r-- | clang/test/Parser/DelayedTemplateParsing.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Parser/DelayedTemplateParsing.cpp b/clang/test/Parser/DelayedTemplateParsing.cpp new file mode 100644 index 00000000000..355250e4b04 --- /dev/null +++ b/clang/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()
+{
+
+}
+
|