diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-23 21:00:28 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-23 21:00:28 +0000 |
commit | 871cd4c131e0b635de9cc6519832b43bc899633f (patch) | |
tree | 11d916d15234ffd47ea5f7f7f9dca954f40a5752 /clang/test/Modules | |
parent | b429083aff15c87ddf598fc09309b55bb1299bf1 (diff) | |
download | bcm5719-llvm-871cd4c131e0b635de9cc6519832b43bc899633f.tar.gz bcm5719-llvm-871cd4c131e0b635de9cc6519832b43bc899633f.zip |
[modules] If a referenced-but-not-instantiated class template specialization
gets explicitly specialized, don't reuse the previous class template
specialization declaration as a new declaration. The benefit here is fairly
marginal, it harms source fidelity, and this is horrible to model if the
specialization was imported from another module (without this change, it
asserts or worse).
llvm-svn: 209552
Diffstat (limited to 'clang/test/Modules')
-rw-r--r-- | clang/test/Modules/Inputs/cxx-templates-a.h | 7 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/cxx-templates-common.h | 3 | ||||
-rw-r--r-- | clang/test/Modules/cxx-templates.cpp | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/cxx-templates-a.h b/clang/test/Modules/Inputs/cxx-templates-a.h index 04acf5929d1..12b647b52de 100644 --- a/clang/test/Modules/Inputs/cxx-templates-a.h +++ b/clang/test/Modules/Inputs/cxx-templates-a.h @@ -56,3 +56,10 @@ template<typename T> struct WithPartialSpecialization<T*> { T &f() { static T t; return t; } }; typedef WithPartialSpecializationUse::type WithPartialSpecializationInstantiate; + +template<> struct WithExplicitSpecialization<int> { + int n; + template<typename T> T &inner_template() { + return n; + } +}; diff --git a/clang/test/Modules/Inputs/cxx-templates-common.h b/clang/test/Modules/Inputs/cxx-templates-common.h index a31be8758cc..986c52b362c 100644 --- a/clang/test/Modules/Inputs/cxx-templates-common.h +++ b/clang/test/Modules/Inputs/cxx-templates-common.h @@ -33,3 +33,6 @@ template<typename T> struct Outer { template<typename T> struct WithPartialSpecialization {}; typedef WithPartialSpecialization<int*> WithPartialSpecializationUse; + +template<typename T> struct WithExplicitSpecialization; +typedef WithExplicitSpecialization<int> WithExplicitSpecializationUse; diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp index a880c9b2f18..f68bc72a271 100644 --- a/clang/test/Modules/cxx-templates.cpp +++ b/clang/test/Modules/cxx-templates.cpp @@ -104,6 +104,7 @@ void g() { TemplateInstantiationVisibility<char[4]> tiv4; int &p = WithPartialSpecializationUse().f(); + int &q = WithExplicitSpecializationUse().inner_template<int>(); } RedeclaredAsFriend<int> raf1; |