summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-03-27 21:57:41 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-03-27 21:57:41 +0000
commitd6aab59ad1e569b50660159e8128797d179bd768 (patch)
tree3cecef1a8b9a4aae8e56bd09d07f137fda9a1d39 /clang/lib/Sema/SemaDecl.cpp
parentafbac28bb3e6f107dc9a8aa831bd121ee6804db4 (diff)
downloadbcm5719-llvm-d6aab59ad1e569b50660159e8128797d179bd768.tar.gz
bcm5719-llvm-d6aab59ad1e569b50660159e8128797d179bd768.zip
[modules] Allow a function template definition if we have a pre-existing but not visible definition of the same template.
llvm-svn: 233430
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 3b9bb842c4e..ce183d0adf4 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -10282,13 +10282,16 @@ Sema::CheckForFunctionRedefinition(FunctionDecl *FD,
if (canRedefineFunction(Definition, getLangOpts()))
return;
- // If we don't have a visible definition of the function, and it's inline,
- // it's OK to form another definition of it.
+ // If we don't have a visible definition of the function, and it's inline or
+ // a template, it's OK to form another definition of it.
//
// FIXME: Should we skip the body of the function and use the old definition
// in this case? That may be necessary for functions that return local types
// through a deduced return type, or instantiate templates with local types.
- if (!hasVisibleDefinition(Definition) && Definition->isInlineSpecified())
+ if (!hasVisibleDefinition(Definition) &&
+ (Definition->isInlineSpecified() ||
+ Definition->getDescribedFunctionTemplate() ||
+ Definition->getNumTemplateParameterLists()))
return;
if (getLangOpts().GNUMode && Definition->isInlineSpecified() &&
OpenPOWER on IntegriCloud