[git commit] tests: tweak algotest
Bernhard Reutner-Fischer
rep.dot.nop at gmail.com
Wed Oct 3 15:28:12 UTC 2018
commit: https://git.uclibc.org/uClibc++/commit/?id=8f6e975d03dcc942a5271c492a6469024e8d045c
branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master
Fix sort() test comparator template argument scope
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
tests/algotest.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/algotest.cpp b/tests/algotest.cpp
index 23ba3ae..2e629ad 100644
--- a/tests/algotest.cpp
+++ b/tests/algotest.cpp
@@ -389,12 +389,28 @@ bool testPartialSort(){
return true;
}
+/* C++-03 and earlier: 14.3.1 Template type arguments [temp.arg.type]:
+ A local type, a type with no linkage, an unnamed type or a type
+ compounded from any of these types shall not be used as a
+ template-argument for a template type-parameter.
+*/
+#if __cplusplus < 201103L
+ struct _my_comp {
+ inline bool operator()(const int &a, const int &b) const {
+ return a > b;
+ }
+ };
+#endif
+
bool testSort() {
+ /* in C++-11 this restriction was lifted */
+#if __cplusplus >= 201103L
struct _my_comp {
inline bool operator()(const int &a, const int &b) const {
return a > b;
}
};
+#endif
std::vector<int> a;
std::vector<int>::iterator i;
More information about the uClibc-cvs
mailing list