Minor bug gets bigger? (was Re: Potential minor bu revealed?)

Gabriel Dos Reis gdr@codesourcery.com
Wed May 8 13:52:00 GMT 2002


Phil Edwards <phil@jaj.com> writes:

[...]

| Now, if I also include <vector>, then the weird error appears.  This makes
| sense to me and my limited understanding of template function overloading:
| the compiler never instantiates the template form of std::swap, since it
| already sees a non-template function.

Does that non-template function really realize a better match?

[...]

| > Other than the confusing error message, would this indicate a potential 
| > problem in vector<bool>?
| 
| Well, it wouldn't be the first problem with vector<bool>...  anyhow,
| I note that the standard doesn't specify a non-template std::swap() for
| vector's "bit reference" class.  But we have one.  The standard /does/
| specify a static non-template member function, std::vector::swap, for the
| bit reference class, but we /don't/ have one.
| 
| Moving the _Bit_reference's swap down inside the vector<bool> specialization,
| like the standard says, makes this problem go away.  I'll post a patch
| after 3.1 is out.

Along with your patch, it would be interesting to trace the path that
leads to that obscure bug.

At least, this is one reason why we should continue moving
non-standard extensions out of std::. 

Thanks for the detective work.

-- Gaby



More information about the Libstdc++ mailing list