public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19712] New: Can not use pow (as a function), must say std::pow explicitly.
@ 2005-01-30 13:50 larsnostdal at gmail dot com
  2005-01-30 13:53 ` [Bug c++/19712] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: larsnostdal at gmail dot com @ 2005-01-30 13:50 UTC (permalink / raw)
  To: gcc-bugs

#include <iostream>
#include <cmath>

using namespace std;

double func(double num, double pow)
{
	return(pow(num, pow));
}

int main()
{
	return(0);
}


 error: `pow' cannot be used as a function


If I add std:: before pow, it works:


double func(double num, double pow)
{
	return(std::pow(num, pow));
}

-- 
           Summary: Can not use pow (as a function), must say std::pow
                    explicitly.
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: larsnostdal at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19712


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19712] Can not use pow (as a function), must say std::pow explicitly.
  2005-01-30 13:50 [Bug c++/19712] New: Can not use pow (as a function), must say std::pow explicitly larsnostdal at gmail dot com
@ 2005-01-30 13:53 ` pinskia at gcc dot gnu dot org
  2005-01-30 14:18 ` larsnostdal at gmail dot com
  2005-01-30 14:27 ` larsnostdal at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-30 13:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-30 13:53 -------
You declared a local variable (parameter) which shadows pow so this is invalid.
try the following:
double func(double num, double pow1)
{
        return(pow(num, pow1));
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19712


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19712] Can not use pow (as a function), must say std::pow explicitly.
  2005-01-30 13:50 [Bug c++/19712] New: Can not use pow (as a function), must say std::pow explicitly larsnostdal at gmail dot com
  2005-01-30 13:53 ` [Bug c++/19712] " pinskia at gcc dot gnu dot org
@ 2005-01-30 14:18 ` larsnostdal at gmail dot com
  2005-01-30 14:27 ` larsnostdal at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: larsnostdal at gmail dot com @ 2005-01-30 14:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From larsnostdal at gmail dot com  2005-01-30 14:18 -------
ouch

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19712


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19712] Can not use pow (as a function), must say std::pow explicitly.
  2005-01-30 13:50 [Bug c++/19712] New: Can not use pow (as a function), must say std::pow explicitly larsnostdal at gmail dot com
  2005-01-30 13:53 ` [Bug c++/19712] " pinskia at gcc dot gnu dot org
  2005-01-30 14:18 ` larsnostdal at gmail dot com
@ 2005-01-30 14:27 ` larsnostdal at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: larsnostdal at gmail dot com @ 2005-01-30 14:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From larsnostdal at gmail dot com  2005-01-30 14:26 -------
Could not -Wshadow (or maybe something similar) warn about these things?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19712


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-01-30 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-30 13:50 [Bug c++/19712] New: Can not use pow (as a function), must say std::pow explicitly larsnostdal at gmail dot com
2005-01-30 13:53 ` [Bug c++/19712] " pinskia at gcc dot gnu dot org
2005-01-30 14:18 ` larsnostdal at gmail dot com
2005-01-30 14:27 ` larsnostdal at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).