Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 59204 invoked from network); 8 Dec 2005 20:06:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Dec 2005 20:06:32 -0000 Received: (qmail 55803 invoked by uid 500); 8 Dec 2005 20:06:31 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 55766 invoked by uid 500); 8 Dec 2005 20:06:31 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 55755 invoked by uid 99); 8 Dec 2005 20:06:31 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2005 12:06:30 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 1734418E for ; Thu, 8 Dec 2005 21:06:10 +0100 (CET) Message-ID: <204725724.1134072370092.JavaMail.jira@ajax.apache.org> Date: Thu, 8 Dec 2005 21:06:10 +0100 (CET) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Resolved: (STDCXX-83) std::generate_n() assumes Size can be decremented In-Reply-To: <618738072.1133991790784.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/STDCXX-83?page=all ] Martin Sebor resolved STDCXX-83: -------------------------------- Resolution: Fixed Fixed and test case added with the referenced changes. > std::generate_n() assumes Size can be decremented > ------------------------------------------------- > > Key: STDCXX-83 > URL: http://issues.apache.org/jira/browse/STDCXX-83 > Project: STDCXX > Type: Bug > Components: 25. Algorithms > Versions: 4.1.2 > Environment: all > Reporter: Martin Sebor > Assignee: Martin Sebor > Priority: Minor > Fix For: 4.1.3 > > The requirement on the Size template argument to std::generate_n() in lib.alg.generate, p2 is that it be convertible to an integral type which does not imply that it be possible to decrement or otherwise modify its value. I.e., the program below is expected to compile successfully. > $ cat t.cpp && nice make t > #include > struct Size { > operator int() { return 0; } > private: > void operator=(Size&); > }; > template void std::generate_n (int*, Size, int (*)()); > int main () { } > eccp -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/eccp-3.6-11s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include -I/build/sebor/dev/stdlib/tests/include -A -x --template_directory=/build/sebor/eccp-3.6-11s/lib -g --display_error_number --remarks --diag_suppress 193,236,340,401,261,479,487,678,679,815 t.cpp > "/build/sebor/dev/stdlib/include/algorithm", line 431: error #349: no operator > "--" matches these operands > operand types are: -- Size > for (; __n > 0; --__n, ++__first) > ^ > detected during instantiation of "void std::generate_n(_OutputIter, > _Size, _Generator) [with _OutputIter=int *, _Size=Size, > _Generator=int (*)()]" at line 9 of "t.cpp" > 1 error detected in the compilation of "t.cpp". -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira