Potential minor bu revealed?

Stephen M. Webb stephen.webb@bregmasoft.com
Tue May 7 12:18:00 GMT 2002


After some tomfoolery, I managed to reproduce an error with the 
following code.

  #include <algorithm>
  #include <iostream>

  int
  main(int, char*[])
  {
    int a;
    const int b;
    std::swap(a, b);
    return 0;
  }

Which is fine, since the code is obviously wrong (swapping into a 
const).  The (potential) problem is the error message I was tracing 
down.

stephen_[176]>  g++ -o br br.cc
br.cc: In function `int main(int, char**)':
br.cc:9: conversion from `int' to non-scalar type `std::_Bit_reference' 
    requested

This message is a little confusing to say the least.  I get a more 
relevant message if I remove the <iostream> inclusion.

stephen_[177]> g++ -o br1 br1.cc
br1.cc: In function `int main(int, char**)':
br1.cc:8: no matching function for call to `swap(int&, const int&)'

Other than the confusing error message, would this indicate a potential 
problem in vector<bool>?

-- 
Stephen M. Webb



More information about the Libstdc++ mailing list