This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] for c++/54537


2012/9/11 Fabien Chêne <fabien.chene@gmail.com>:
> Oops, not sure how I test that change initially, or I must be blind,
> because it triggers an error in tr1/cmath about pow. I'll see what I
> can do...

Well, as summarized in the code below, the problem seems to be the
redundant overload of std::tr1::pow(double,double). As one can note
that std::pow(double,double) is not defined, I guess the right fix
would consist in removing the definition of
std::tr1::pow(double,double).

extern double pow (double __x, double __y) throw ();

namespace std
{
  using ::pow;

  inline float
  pow(float __x, float __y)
  { return __builtin_powf(__x, __y); }

  inline long double
  pow(long double __x, long double __y)
  { return __builtin_powl(__x, __y); }
}

namespace std
{
namespace tr1
{
  // inline double
  // pow(double __x, double __y)
  // { return std::pow(__x, __y); }

  inline float
  pow(float __x, float __y)
  { return std::pow(__x, __y); }

  inline long double
  pow(long double __x, long double __y)
  { return std::pow(__x, __y); }
}
}

While looking into this problem, I found it bothering not to have the
conflicting declaration mentioned. Hence, I have modified the original
patch to call diagnose_name_conflict in case of error.

Bootstrapped/Tested x86_64-unknown-linux-gnu.

2012-09-18  Fabien Chêne  <fabien@gcc.gnu.org>
        PR c++/54537
        * cp-tree.h: Check OVL_USED with OVERLOAD_CHECK.
        * name-lookup.c (do_nonmember_using_decl): Make sure we have an
	OVERLOAD before calling OVL_USED. Call diagnose_name_conflict
	instead of issuing an error without mentioning the conflicting
	declaration.

2012-09-18  Fabien Chêne  <fabien@gcc.gnu.org>

        PR c++/54537
        * g++.dg/overload/using3.C: New.
	* g++.dg/overload/using2.C: Adjust.
	* g++.dg/lookup/using9.C: Likewise.

2012-09-18  Fabien Chêne  <fabien@gcc.gnu.org>

        PR c++/54537
	* include/tr1/cmath: Remove pow(double,double) overload.

-- 
Fabien


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]