diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-03-24 17:31:23 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-03-24 17:31:23 +0000 |
| commit | 8fdd0e8cd6dbff73584b8cd5910a0e3cc1e31694 (patch) | |
| tree | 0c0b40ecf95ff2f7b508f6dcd5ba7e8322cbde13 | |
| parent | 2538674a98e74c605d61271ea49a37448c25c76a (diff) | |
| download | bcm5719-llvm-8fdd0e8cd6dbff73584b8cd5910a0e3cc1e31694.tar.gz bcm5719-llvm-8fdd0e8cd6dbff73584b8cd5910a0e3cc1e31694.zip | |
Silently drop dependent friend function template specializations,
since we have absolutely no way to match them when they are declared
nor do we have a way to represent these parsed-but-not-checked friend
declarations.
llvm-svn: 99407
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 15 | ||||
| -rw-r--r-- | clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp | 12 |
2 files changed, 22 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e802018c9f8..e4c930e2f85 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3130,10 +3130,17 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, } if (isFunctionTemplateSpecialization) { - if (CheckFunctionTemplateSpecialization(NewFD, - (HasExplicitTemplateArgs ? &TemplateArgs : 0), - Previous)) - NewFD->setInvalidDecl(); + if (isFriend && NewFD->getType()->isDependentType()) { + // FIXME: When we see a friend of a function template + // specialization with a dependent type, we can't match it now; + // for now, we just drop it, until we have a reasonable way to + // represent the parsed-but-not-matched friend function template + // specialization in the AST. + return 0; + } else if (CheckFunctionTemplateSpecialization(NewFD, + (HasExplicitTemplateArgs ? &TemplateArgs : 0), + Previous)) + NewFD->setInvalidDecl(); } else if (isExplicitSpecialization && isa<CXXMethodDecl>(NewFD) && CheckMemberSpecialization(NewFD, Previous)) NewFD->setInvalidDecl(); diff --git a/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp index 0f18e76f52a..277106c2bd9 100644 --- a/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp +++ b/clang/test/CXX/temp/temp.decls/temp.friend/p1.cpp @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -faccess-control -verify -emit-llvm-only %s - template <typename T> struct Num { T value_; @@ -117,3 +116,14 @@ namespace test3 { template class User<int>; // expected-note {{requested here}} } + +namespace Dependent { + template<typename T, typename Traits> class X; + template<typename T, typename Traits> + X<T, Traits> operator+(const X<T, Traits>&, const T*); + + template<typename T, typename Traits> class X { + typedef typename Traits::value_type value_type; + friend X operator+<>(const X&, const value_type*); + }; +} |

