From: Chris Lattner Date: Thu, 3 Jun 2004 18:48:59 +0000 (+0000) Subject: Only use the non-standards-compliant std::distance on the compiler that is X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=6bf7ca5f6f1c26bf8fb579ba456dae7c6e6f7e3a;p=oota-llvm.git Only use the non-standards-compliant std::distance on the compiler that is buggy, not for all compilers that are not GCC 3 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13990 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/Support/ilist b/include/Support/ilist index bfa601f9c9f..499c3e2b9d5 100644 --- a/include/Support/ilist +++ b/include/Support/ilist @@ -438,13 +438,14 @@ public: // size_type size() const { -#if __GNUC__ == 3 - size_type Result = std::distance(begin(), end()); -#else +#if __GNUC__ == 2 + // GCC 2.95 has a broken std::distance size_type Result = 0; std::distance(begin(), end(), Result); -#endif return Result; +#else + return std::distance(begin(), end()); +#endif } iterator erase(iterator first, iterator last) { diff --git a/include/llvm/ADT/ilist b/include/llvm/ADT/ilist index bfa601f9c9f..499c3e2b9d5 100644 --- a/include/llvm/ADT/ilist +++ b/include/llvm/ADT/ilist @@ -438,13 +438,14 @@ public: // size_type size() const { -#if __GNUC__ == 3 - size_type Result = std::distance(begin(), end()); -#else +#if __GNUC__ == 2 + // GCC 2.95 has a broken std::distance size_type Result = 0; std::distance(begin(), end(), Result); -#endif return Result; +#else + return std::distance(begin(), end()); +#endif } iterator erase(iterator first, iterator last) {