[LLVMbugs] [Bug 2173] New: llvm::cin operator >> broken

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Mar 25 07:31:56 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2173

           Summary: llvm::cin operator >> broken
           Product: libraries
           Version: 2.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Support Libraries
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dekruijf at cs.wisc.edu
                CC: llvmbugs at cs.uiuc.edu


The >> operator for the class BaseStream in include/llvm/Support/Streams.h does
not work because the argument type is declared as 'const'.  It must *not* be
'const', because the >> operator modifies its argument.  With the patch below,
it now works.

Index: include/llvm/Support/Streams.h
===================================================================
--- include/llvm/Support/Streams.h      (revision 1)
+++ include/llvm/Support/Streams.h      (working copy)
@@ -46,7 +46,7 @@
     }

     template <typename Ty>
-    BaseStream &operator >> (const Ty &Thing) {
+    BaseStream &operator >> (Ty &Thing) {
       if (Stream) *Stream >> Thing;
       return *this;
     }


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list