Issue Details (XML | Word | Printable)

Key: STDCXX-614
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Travis Vitek
Reporter: Martin Sebor
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

[gcc 4.1/Linux] error on size_t in 27.stringbuf.xsputn.stdcxx-515.cpp

Created: 24/Oct/07 08:12 PM   Updated: 29/Jan/08 07:59 PM
Return to search
Component/s: Tests
Affects Version/s: 4.2.0
Fix Version/s: 4.2.1

Time Tracking:
Not Specified

Environment: gcc 4.1.1 on Red Hat Enterprise Linux Server release 5 (Tikanga)
Issue Links:
Duplicate
 

Patch Info: Patch Available
Severity: Compiler Error
Resolution Date: 18/Dec/07 11:03 PM


 Description  « Hide
The 27.stringbuf.xsputn.stdcxx-515.cpp fails to compile with gcc 4.1.1 on Red Hat Enterprise Linux Server release 5 with the error below:

gcc -c -I$(TOPDIR)/include/ansi -D_RWSTDDEBUG -I$(TOPDIR)/include -I$(BUILDDIR)/include -I$(TOPDIR)/tests/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align $(TOPDIR)/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp
$(TOPDIR)/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp: In function 'int main()':
$(TOPDIR)/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp:33: error: 'size_t' was not declared in this scope
$(TOPDIR)/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp:33: error: expected `;' before 'i'
$(TOPDIR)/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp:33: error: 'i' was not declared in this scope
gmake: *** [27.stringbuf.xsputn.stdcxx-515.o] Error 1



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Martin Sebor added a comment - 24/Oct/07 08:22 PM
The same problem when compiled with HP aCC. We're probably just missing the std:: qualification or the required header.

aCC -c -D_RWSTDDEBUG -I$(TOPDIR)/include -I$(BUILDDIR)/include -I$(TOPDIR)/tests/include -AA -g +d +DD64 +w +W392 +W655 +W684 +W818 +W819 +W849 $(TOPDIR)/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp
Error 419: "$(TOPDIR)/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp", line 33 # 'size_t' is used as a type, but has not been defined as a type.
for (size_t i = 1; i <= 1024; ++i) {
^^^^^^
Warning (suggestion) 887: "$(TOPDIR)/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp", line 35 # Type 'int' is smaller than type 'unsigned long', unwanted widening in value may result.
std::string s (i, 'a');
^
gmake: *** [27.stringbuf.xsputn.stdcxx-515.o] Error 2


Travis Vitek made changes - 29/Oct/07 10:02 PM
Field Original Value New Value
Assignee Travis Vitek [ vitek ]
Travis Vitek added a comment - 29/Oct/07 10:17 PM
2007-10-29 Travis Vitek <vitek@roguewave.com>

STDCXX-614

  • 27.stringbuf.xsputn.stdcxx-515.cpp (main): Include header
    and add namespace qualifier as required to compile.

Index: 27.stringbuf.xsputn.stdcxx-515.cpp
===================================================================
— 27.stringbuf.xsputn.stdcxx-515.cpp (revision 589749)
+++ 27.stringbuf.xsputn.stdcxx-515.cpp (working copy)
@@ -27,10 +27,11 @@
#include <sstream> // for stringstream
#include <string> // for string
#include <cassert> // for assert()
+#include <cstddef> // for size_t

int main ()
{

  • for (size_t i = 1; i <= 1024; ++i) {
    + for (std::size_t i = 1; i <= 1024; ++i) {
    std::stringstream strm;
    std::string s (i, 'a');
    strm << s;

Travis Vitek made changes - 29/Oct/07 10:17 PM
Patch Info [Patch Available]
Repository Revision Date User Message
ASF #589892 Mon Oct 29 22:27:47 UTC 2007 sebor 2007-10-29 Travis Vitek <vitek@roguewave.com>

STDCXX-614
* 27.stringbuf.xsputn.STDCXX-515.cpp (main): Include header
and add namespace qualifier as required to compile.
Files Changed
MODIFY /incubator/stdcxx/branches/4.2.x/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp

Repository Revision Date User Message
ASF #589893 Mon Oct 29 22:29:07 UTC 2007 sebor 2007-10-29 Travis Vitek <vitek@roguewave.com>

Merged rev 589892 (fix for STDCXX-614) from branches/4.2.x.
* 27.stringbuf.xsputn.STDCXX-515.cpp (main): Include header
and add namespace qualifier as required to compile.
Files Changed
MODIFY /incubator/stdcxx/trunk/tests/regress/27.stringbuf.xsputn.stdcxx-515.cpp

Travis Vitek added a comment - 18/Dec/07 11:03 PM
Verified in automated testing.

Travis Vitek made changes - 18/Dec/07 11:03 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]
Martin Sebor made changes - 29/Jan/08 07:59 PM
Link This issue is duplicated by STDCXX-691 [ STDCXX-691 ]