public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function"
@ 2003-10-12  1:58 mckelvey at maskull dot com
  2003-10-12  2:13 ` [Bug c++/12582] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: mckelvey at maskull dot com @ 2003-10-12  1:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: [3.4 Regression] "declaration of `operator()' as non-
                    function"
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mckelvey at maskull dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alphaev56-unknown-linux-gnu
  GCC host triplet: alphaev56-unknown-linux-gnu
GCC target triplet: alphaev56-unknown-linux-gnu

Something wrong with namespace lookup? locale defines float_t, I presume in std,
but error is wildly inappropriate. Error goes away if float_t is qualified with
PM::, but not with std::.


/usr/local/bin/g++ -v -c stest.cc


Reading specs from /usr/local/lib/gcc/alphaev56-unknown-linux-gnu/3.4/specs
Configured with: ../gcc/configure --verbose --enable-languages=c++
Thread model: posix
gcc version 3.4 20031011 (experimental)
 /usr/local/libexec/gcc/alphaev56-unknown-linux-gnu/3.4/cc1plus -quiet -v
stest.cc -quiet -dumpbase stest.cc -mcpu=ev56 -auxbase stest -version -o
/tmp/ccy1TR9O.s
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
"/usr/local/lib/gcc/alphaev56-unknown-linux-gnu/3.4/../../../../alphaev56-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/alphaev56-unknown-linux-gnu/3.4/../../../../include/c++/3.4

/usr/local/lib/gcc/alphaev56-unknown-linux-gnu/3.4/../../../../include/c++/3.4/alphaev56-unknown-linux-gnu

/usr/local/lib/gcc/alphaev56-unknown-linux-gnu/3.4/../../../../include/c++/3.4/backward
 /usr/local/include
 /usr/local/lib/gcc/alphaev56-unknown-linux-gnu/3.4/include
 /usr/include
End of search list.
GNU C++ version 3.4 20031011 (experimental) (alphaev56-unknown-linux-gnu)
	compiled by GNU C version 3.4 20031011 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
stest.cc:17: error: declaration of `operator()' as non-function
stest.cc:17: error: expected function-definition

#include <locale>

namespace PM
{

typedef double float_t;

}

using namespace PM;


class functor_t
{
public:

    int operator()(const float_t& argument1);
};


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

* [Bug c++/12582] "declaration of `operator()' as non-function"
  2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
@ 2003-10-12  2:13 ` pinskia at gcc dot gnu dot org
  2003-10-12  2:36 ` mckelvey at maskull dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-12  2:13 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.4 Regression]            |"declaration of `operator()'
                   |"declaration of `operator()'|as non-function"
                   |as non-function"            |


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-12 02:13 -------
Not a regression as it happens in 2.95.3 to 3.3 with a parse error.
The preprocessed source looks like this:
typedef float float_t;
namespace PM
{
typedef double float_t;
}
using namespace PM;
class functor_t
{
public:
    int operator()(const float_t& argument1);
};

I do not know if the code is valid though, I do not have my standard infront of me now.


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

* [Bug c++/12582] "declaration of `operator()' as non-function"
  2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
  2003-10-12  2:13 ` [Bug c++/12582] " pinskia at gcc dot gnu dot org
@ 2003-10-12  2:36 ` mckelvey at maskull dot com
  2003-10-12  2:48 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mckelvey at maskull dot com @ 2003-10-12  2:36 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From mckelvey at maskull dot com  2003-10-12 02:36 -------
Excuse me, but if the code is invalid, wasn't it MADE invalid by <locale>
declaring the typedef outside of namespace std?

Also, the error message is wrong in any case, or at least very obscure.


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

* [Bug c++/12582] "declaration of `operator()' as non-function"
  2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
  2003-10-12  2:13 ` [Bug c++/12582] " pinskia at gcc dot gnu dot org
  2003-10-12  2:36 ` mckelvey at maskull dot com
@ 2003-10-12  2:48 ` pinskia at gcc dot gnu dot org
  2003-10-22  1:29 ` [Bug c++/12582] unhelpful message with ambiguous typedef bangerth at dealii dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-12  2:48 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-12 02:48 -------
Actually the only thing needed to include is cmath but there is already a bug for all c++ headers 
putting items in the global namespace but since the c++ header files include the corespoding c 
header file and the c header file is part of the c library which is not part of gcc at all, we (gcc 
developers) have a hard time to fix this problem.


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

* [Bug c++/12582] unhelpful message with ambiguous typedef
  2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
                   ` (2 preceding siblings ...)
  2003-10-12  2:48 ` pinskia at gcc dot gnu dot org
@ 2003-10-22  1:29 ` bangerth at dealii dot org
  2003-12-29  1:30 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2003-10-22  1:29 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-10-22 01:28:34
               date|                            |
            Summary|"declaration of `operator()'|unhelpful message with
                   |as non-function"            |ambiguous typedef


------- Additional Comments From bangerth at dealii dot org  2003-10-22 01:28 -------
I think this is actually a diagnostic problem. For Andrew's testcase, this is the message 
that we get from 3.3 and 3.4: 
 
tmp/g> ~/bin/gcc-3.3/bin/c++ -c x.cc 
x.cc:10: error: parse error before `&' token 
tmp/g> 
tmp/g> ../build-gcc/gcc-install/bin/c++ -c x.cc 
x.cc:10: error: declaration of `operator()' as non-function 
x.cc:10: error: expected function-definition 
 
Both don't say what's wrong. Use icc instead: 
tmp/g> icc -c x.cc 
x.cc(10): error: "float_t" is ambiguous 
      int operator()(const float_t& argument1); 
                           ^ 
 
compilation aborted for x.cc (code 2) 
 
That's the reason. In other words, the code is wrong, but gcc's error messages are 
not really helpful in discovering this. 
 
W.


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

* [Bug c++/12582] unhelpful message with ambiguous typedef
  2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
                   ` (3 preceding siblings ...)
  2003-10-22  1:29 ` [Bug c++/12582] unhelpful message with ambiguous typedef bangerth at dealii dot org
@ 2003-12-29  1:30 ` pinskia at gcc dot gnu dot org
  2004-04-27  0:40 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-29  1:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-28 23:14 -------
The error message is better:
pr12582.cc:11: error: expected `,' or `...' before '&' token
pr12582.cc:11: error: ISO C++ forbids declaration of `float_t' with no type

Related to bug 12272.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2003-12-06 09:53:10         |2003-12-28 23:14:27
               date|                            |


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


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

* [Bug c++/12582] unhelpful message with ambiguous typedef
  2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
                   ` (4 preceding siblings ...)
  2003-12-29  1:30 ` pinskia at gcc dot gnu dot org
@ 2004-04-27  0:40 ` pinskia at gcc dot gnu dot org
  2004-10-21 12:45 ` pinskia at gcc dot gnu dot org
  2005-09-10 19:26 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27  0:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 00:04 -------
Another example:
typedef float float_t;
namespace PM
{
typedef double float_t;
}
using namespace PM;
float_t t;

pr12582.cc:8: error: `float_t' does not name a type

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2003-12-28 23:14:27         |2004-04-27 00:04:36
               date|                            |


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


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

* [Bug c++/12582] unhelpful message with ambiguous typedef
  2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
                   ` (5 preceding siblings ...)
  2004-04-27  0:40 ` pinskia at gcc dot gnu dot org
@ 2004-10-21 12:45 ` pinskia at gcc dot gnu dot org
  2005-09-10 19:26 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-21 12:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-21 12:44 -------
*** Bug 18097 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |loose at astron dot nl


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


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

* [Bug c++/12582] unhelpful message with ambiguous typedef
  2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
                   ` (6 preceding siblings ...)
  2004-10-21 12:45 ` pinskia at gcc dot gnu dot org
@ 2005-09-10 19:26 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-10 19:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-10 19:25 -------
This is a dup of bug 100.

*** This bug has been marked as a duplicate of 100 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-09-10 19:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-12  1:58 [Bug c++/12582] New: [3.4 Regression] "declaration of `operator()' as non-function" mckelvey at maskull dot com
2003-10-12  2:13 ` [Bug c++/12582] " pinskia at gcc dot gnu dot org
2003-10-12  2:36 ` mckelvey at maskull dot com
2003-10-12  2:48 ` pinskia at gcc dot gnu dot org
2003-10-22  1:29 ` [Bug c++/12582] unhelpful message with ambiguous typedef bangerth at dealii dot org
2003-12-29  1:30 ` pinskia at gcc dot gnu dot org
2004-04-27  0:40 ` pinskia at gcc dot gnu dot org
2004-10-21 12:45 ` pinskia at gcc dot gnu dot org
2005-09-10 19:26 ` pinskia at gcc dot gnu dot org

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).