From: Douglas Gregor Date: Fri, 21 Aug 2009 22:16:40 +0000 (+0000) Subject: Fix parsing for out-of-line definitions of constructors and X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac373c4ca596a144d906570f284d46d702e10719;p=clang Fix parsing for out-of-line definitions of constructors and destructors of class templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79678 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 5de302e174..49ad45ad7a 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/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(DC); } else CurDecl = dyn_cast_or_null(CurContext); diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp index c1da8a1f48..84454900bb 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1.cpp +++ b/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 void X0::f0(const T&, const U&) { // expected-error{{redefinition}} } -// FIXME: test out-of-line constructors, destructors +// Test out-of-line constructors, destructors +template +X0::X0(int x) : value(x) { } + +template +X0::~X0() { } +