Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-11-22 13:28:34


"K. Noel Belcourt" ha escrito:

> On Nov 22, 2007, at 3:22 AM, Joaquín Mª López Muñoz wrote:
>
> > Noel, could you please try the following variation of the test snippet, which
> > tries to mimic as closely as possible the structure of the failing code? Thank you!
>
> Okay, here it is.
>
> > xlC fsudba3.cpp
> "fsudba3.cpp", line 12.10: 1540-0256 (S) A parameter of type
> "foo<int> &" cannot be initialized with an expression of type "int".
> "fsudba3.cpp", line 12.10: 1540-1205 (I) The error occurred while
> converting to parameter 1 of "foo<int>::swap(foo<int> &)".
> "fsudba3.cpp", line 9.8: 1540-0700 (I) The previous message was
> produced while processing "foo<int>::swap_(foo<int> &)".
> "fsudba3.cpp", line 8.21: 1540-0700 (I) The previous message was
> produced while processing "foo<int>::swap(foo<int> &)".
> "fsudba3.cpp", line 25.8: 1540-0700 (I) The previous message was
> produced while processing "main()".

Ok, so we've got a case again. John, let me re-ask you about what we
should do regarding this compiler bug. For your reference, the offending code
does not involve name hiding anymore:

  #include <algorithm>

  template<typename T>
  struct foo
  {
    T t;
    foo():t(0){}
    void swap(foo& x){swap_(x);}
    void swap_(foo& x)
    {
      using std::swap;
      swap(t,x.t);
    }
  };

  template<typename T>
  void swap(foo<T>& x,foo<T>& y)
  {
    x.swap(y);
  }

  int main()
  {
    foo<int> x,y;
    x.swap(y);
  }

Of course there's no big problem if it's decided that this shouldn't be covered
by BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL,
but I think the bug qualifies as a reasonable extension for the concept covered
by the macro.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk