summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-07-11 00:20:06 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-07-11 00:20:06 +0000
commitdc5523d38fc12d167d83b8d4732a78fbf9be70b4 (patch)
treee45ad19f76dc62e7ea3db850a6d8e01c10d0d6d0 /clang/test
parent7660d653c8173f9586a2e8a5a4f9e2516de7ca7c (diff)
downloadbcm5719-llvm-dc5523d38fc12d167d83b8d4732a78fbf9be70b4.tar.gz
bcm5719-llvm-dc5523d38fc12d167d83b8d4732a78fbf9be70b4.zip
[modules] Don't try to merge template specializations by performing name lookup
into their container; we won't find them there. These things are already being merged when they're added to their primary template's folding set, so this merging is redundant (and causes us to reject-valid because we think we've found an odr violation). llvm-svn: 212788
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/Inputs/cxx-templates-a.h4
-rw-r--r--clang/test/Modules/Inputs/cxx-templates-b.h4
-rw-r--r--clang/test/Modules/Inputs/cxx-templates-common.h4
-rw-r--r--clang/test/Modules/cxx-templates.cpp3
4 files changed, 13 insertions, 2 deletions
diff --git a/clang/test/Modules/Inputs/cxx-templates-a.h b/clang/test/Modules/Inputs/cxx-templates-a.h
index 12b647b52de..5ac1697bff6 100644
--- a/clang/test/Modules/Inputs/cxx-templates-a.h
+++ b/clang/test/Modules/Inputs/cxx-templates-a.h
@@ -63,3 +63,7 @@ template<> struct WithExplicitSpecialization<int> {
return n;
}
};
+
+template<typename T> template<typename U>
+constexpr int Outer<T>::Inner<U>::f() { return 1; }
+static_assert(Outer<int>::Inner<int>::f() == 1, "");
diff --git a/clang/test/Modules/Inputs/cxx-templates-b.h b/clang/test/Modules/Inputs/cxx-templates-b.h
index a6828553027..efd07c617e5 100644
--- a/clang/test/Modules/Inputs/cxx-templates-b.h
+++ b/clang/test/Modules/Inputs/cxx-templates-b.h
@@ -20,6 +20,10 @@ extern DefinedInCommon &defined_in_common;
template<int> struct MergeTemplates;
MergeTemplates<0> *merge_templates_b;
+template<typename T> template<typename U>
+constexpr int Outer<T>::Inner<U>::g() { return 2; }
+static_assert(Outer<int>::Inner<int>::g() == 2, "");
+
@import cxx_templates_b_impl;
template<typename T, typename> struct Identity { typedef T type; };
diff --git a/clang/test/Modules/Inputs/cxx-templates-common.h b/clang/test/Modules/Inputs/cxx-templates-common.h
index 986c52b362c..682ef939cec 100644
--- a/clang/test/Modules/Inputs/cxx-templates-common.h
+++ b/clang/test/Modules/Inputs/cxx-templates-common.h
@@ -26,8 +26,8 @@ template<typename T> struct TemplateInstantiationVisibility { typedef int type;
template<typename T> struct Outer {
template<typename U> struct Inner {
- void f();
- void g();
+ static constexpr int f();
+ static constexpr int g();
};
};
diff --git a/clang/test/Modules/cxx-templates.cpp b/clang/test/Modules/cxx-templates.cpp
index f68bc72a271..679d7d12b1b 100644
--- a/clang/test/Modules/cxx-templates.cpp
+++ b/clang/test/Modules/cxx-templates.cpp
@@ -107,6 +107,9 @@ void g() {
int &q = WithExplicitSpecializationUse().inner_template<int>();
}
+static_assert(Outer<int>::Inner<int>::f() == 1, "");
+static_assert(Outer<int>::Inner<int>::g() == 2, "");
+
RedeclaredAsFriend<int> raf1;
RedeclareTemplateAsFriend<double> rtaf;
RedeclaredAsFriend<double> raf2;
OpenPOWER on IntegriCloud