summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-08-21 22:16:40 +0000
committerDouglas Gregor <dgregor@apple.com>2009-08-21 22:16:40 +0000
commite5bbb7d4ef94a5c79020b0fb2bbf4168c52d094b (patch)
tree9f82f91d3ac3fe42af04ff7d37b6dbf246bbbfe9
parent13e8c7ef203ab409fc425524491aeea9b7ded975 (diff)
downloadbcm5719-llvm-e5bbb7d4ef94a5c79020b0fb2bbf4168c52d094b.tar.gz
bcm5719-llvm-e5bbb7d4ef94a5c79020b0fb2bbf4168c52d094b.zip
Fix parsing for out-of-line definitions of constructors and
destructors of class templates. llvm-svn: 79678
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp2
-rw-r--r--clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp11
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 5de302e1741..49ad45ad7ae 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -329,7 +329,7 @@ bool Sema::isCurrentClassName(const IdentifierInfo &II, Scope *,
const CXXScopeSpec *SS) {
CXXRecordDecl *CurDecl;
if (SS && SS->isSet() && !SS->isInvalid()) {
- DeclContext *DC = computeDeclContext(*SS);
+ DeclContext *DC = computeDeclContext(*SS, true);
CurDecl = dyn_cast_or_null<CXXRecordDecl>(DC);
} else
CurDecl = dyn_cast_or_null<CXXRecordDecl>(CurContext);
diff --git a/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp
index c1da8a1f480..84454900bb5 100644
--- a/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp
+++ b/clang/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp
@@ -5,6 +5,9 @@ class X0 {
public:
typedef int size_type;
+ X0(int);
+ ~X0();
+
void f0(const T&, const U&);
T& operator[](int i) const;
@@ -46,4 +49,10 @@ template<typename T, typename U>
void X0<T, U>::f0(const T&, const U&) { // expected-error{{redefinition}}
}
-// FIXME: test out-of-line constructors, destructors
+// Test out-of-line constructors, destructors
+template<typename T, typename U>
+X0<T, U>::X0(int x) : value(x) { }
+
+template<typename T, typename U>
+X0<T, U>::~X0() { }
+
OpenPOWER on IntegriCloud