Logo Search packages:      
Sourcecode: gcc-2.96 version File versions

bug-36600.cc

/*
This is a C++ program that, by my
understanding, should compile cleanly but does not.  I don't have
another compiler to test it with, unfortnately (eg. the Sun compiler).
I'd try it on gcc-2.95 but I can't risk installing a non-stable
version of g++ at this time.  Hopefully you can try it.
*/

#include <multiset.h>

int main(void)
{
  multiset<int, less<int> > x;
  x.insert(5);
  multiset<int, less<int> >::iterator iter = x.begin();
  int& y __attribute__((unused)) = *iter;
}
/*
[patricia:~]g++ test.cpp
test.cpp: In function `int main(...)':
test.cpp:8: warning: conversion from `const int' to `int &' discards const
[patricia:~]

:  > Package: libstdc++2.9-dev
:  > Version: 2.91.60-5
:  > 
:  > The Dec 2, 1996 draft of the "Working Paper for Draft Proposed
:  > International Standard for Information Systems Programming Language
:  > C++" says that the multiset must support forward iterators.  A forward
:  > iterator's operator* must return a reference (T&).  The implementation
:  > in libstdc++2.9-dev multiset.h returns a const reference (const T&).
:  > This is not correct.
:  > 
:  > I believe this problem also exists in version 2.91.66-1 as the
:  > relevant source code hasn't changed.  However, I haven't compiled
:  > anything with the newer version.
*/

Generated by  Doxygen 1.6.0   Back to index