public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14875] New: No or in function names allowed
@ 2004-04-07 11:58 j dot werner at physik dot uni-stuttgart dot de
2004-04-07 12:25 ` [Bug c++/14875] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: j dot werner at physik dot uni-stuttgart dot de @ 2004-04-07 11:58 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3082 bytes --]
The following code fails to compile using gcc-3.4:
Sample.hpp:
#ifndef __SAMPLE__
#define __SAMPLE__
using namespace std;
class Sample
{
public:
Sample::Sample();
void Sample::or(long Digital);
};
#endif
Sample.cpp:
#include "Sample.hpp"
Sample::Sample()
{
}
void Sample::or(long Digital)
{
}
joerg@uhldingen:~$ LANG=C g++-3.4 -v -save-temps Sample.cpp
Reading specs from /usr/lib/gcc/i486-linux/3.4.0/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --enable-threads=posix
--without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.0 20040403 (prerelease) (Debian)
/usr/lib/gcc/i486-linux/3.4.0/cc1plus -E -quiet -v -D_GNU_SOURCE Sample.cpp
-mtune=i486 -o Sample.ii
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux/3.4.0/../../../../i486-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/3.4
/usr/include/c++/3.4/i486-linux
/usr/include/c++/3.4/backward
/usr/local/include
/usr/lib/gcc/i486-linux/3.4.0/include
/usr/include
End of search list.
/usr/lib/gcc/i486-linux/3.4.0/cc1plus -fpreprocessed Sample.ii -quiet
-dumpbase Sample.cpp -mtune=i486 -auxbase Sample -version -o Sample.s
GNU C++ version 3.4.0 20040403 (prerelease) (Debian) (i486-linux)
compiled by GNU C version 3.4.0 20040403 (prerelease) (Debian).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64362
In file included from Sample.cpp:1:
Sample.hpp:11: error: expected unqualified-id before '||' token
Sample.hpp:11: error: abstract declarator `void' used as declaration
Sample.hpp:11: error: variable or field `type name' declared void
Sample.hpp:11: error: expected `;' before '||' token
Sample.cpp:7: error: expected unqualified-id before '||' token
Sample.cpp:7: error: expected init-declarator before '||' token
Sample.cpp:7: error: expected `,' or `;' before '||' token
Sample.ii:
# 1 "Sample.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "Sample.cpp"
# 1 "Sample.hpp" 1
using namespace std;
class Sample
{
public:
Sample::Sample();
void Sample::or(long Digital);
};
# 2 "Sample.cpp" 2
Sample::Sample()
{
}
void Sample::or(long Digital)
{
}
Is or in function names not allowed?
Greetings,
Jörg
--
Summary: No or in function names allowed
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: j dot werner at physik dot uni-stuttgart dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14875
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/14875] No or in function names allowed
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
@ 2004-04-07 12:25 ` pinskia at gcc dot gnu dot org
2004-04-07 13:19 ` giovannibajo at libero dot it
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-07 12:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-07 12:25 -------
In C++ or is a keyword for |, so this is invalid.
Also the follow are keywords:
and &
xor ^
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14875
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/14875] No or in function names allowed
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
2004-04-07 12:25 ` [Bug c++/14875] " pinskia at gcc dot gnu dot org
@ 2004-04-07 13:19 ` giovannibajo at libero dot it
2004-04-07 13:23 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token giovannibajo at libero dot it
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-04-07 13:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-04-07 13:19 -------
Yes, but the diagnostic is totally confusing
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14875
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
2004-04-07 12:25 ` [Bug c++/14875] " pinskia at gcc dot gnu dot org
2004-04-07 13:19 ` giovannibajo at libero dot it
@ 2004-04-07 13:23 ` giovannibajo at libero dot it
2004-04-07 13:31 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-04-07 13:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-04-07 13:22 -------
Keeping this as a diagnostic enchancement: we should emit a proper error
message.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2004-04-07 13:22:54
date| |
Summary|No or in function names |When using 'or' keyword, the
|allowed |error message speaks of a
| |'||' token
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14875
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
` (2 preceding siblings ...)
2004-04-07 13:23 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token giovannibajo at libero dot it
@ 2004-04-07 13:31 ` pinskia at gcc dot gnu dot org
2004-04-08 18:34 ` bangerth at dealii dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-07 13:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-07 13:31 -------
Just for comparision here is what ICC 6.0 says:
pr14875.cc(5): warning #470: qualified name is not allowed in member declaration
Sample::Sample();
^
pr14875.cc(6): error: expected an identifier
void Sample::or(long Digital);
^
pr14875.cc(6): warning #470: qualified name is not allowed in member declaration
void Sample::or(long Digital);
^
pr14875.cc(6): error: expected a ";"
void Sample::or(long Digital);
^
compilation aborted for pr14875.cc (code 2)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14875
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
` (3 preceding siblings ...)
2004-04-07 13:31 ` pinskia at gcc dot gnu dot org
@ 2004-04-08 18:34 ` bangerth at dealii dot org
2004-04-08 18:53 ` Zack Weinberg
2004-04-08 18:53 ` zack at codesourcery dot com
2004-04-08 19:54 ` gdr at integrable-solutions dot net
6 siblings, 1 reply; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-04-08 18:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-04-08 18:34 -------
The problem is that the token is already converted by the preprocessor.
This is why the error message has the '||' token in it. So I assume there
is not so much the compiler can do anymore, since it doesn't even get to
see the original token.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14875
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
2004-04-08 18:34 ` bangerth at dealii dot org
@ 2004-04-08 18:53 ` Zack Weinberg
0 siblings, 0 replies; 9+ messages in thread
From: Zack Weinberg @ 2004-04-08 18:53 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
The preprocessor will have marked the token with the NAMED_OP flag,
it might be possible to expose that to the diagnostics.
zw
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
` (4 preceding siblings ...)
2004-04-08 18:34 ` bangerth at dealii dot org
@ 2004-04-08 18:53 ` zack at codesourcery dot com
2004-04-08 19:54 ` gdr at integrable-solutions dot net
6 siblings, 0 replies; 9+ messages in thread
From: zack at codesourcery dot com @ 2004-04-08 18:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From zack at codesourcery dot com 2004-04-08 18:53 -------
Subject: Re: When using 'or' keyword, the error message
speaks of a '||' token
The preprocessor will have marked the token with the NAMED_OP flag,
it might be possible to expose that to the diagnostics.
zw
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14875
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
` (5 preceding siblings ...)
2004-04-08 18:53 ` zack at codesourcery dot com
@ 2004-04-08 19:54 ` gdr at integrable-solutions dot net
6 siblings, 0 replies; 9+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-04-08 19:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2004-04-08 19:53 -------
Subject: Re: When using 'or' keyword, the error message speaks of a '||' token
"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| The problem is that the token is already converted by the preprocessor.
| This is why the error message has the '||' token in it. So I assume there
| is not so much the compiler can do anymore, since it doesn't even get to
| see the original token.
I seem to recall that when Giovanni worked on these digraph thingies,
it was pointed out that our CPP is able to mark a pp-token whether it
is a digraph or not.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14875
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-04-08 19:54 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
2004-04-07 12:25 ` [Bug c++/14875] " pinskia at gcc dot gnu dot org
2004-04-07 13:19 ` giovannibajo at libero dot it
2004-04-07 13:23 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token giovannibajo at libero dot it
2004-04-07 13:31 ` pinskia at gcc dot gnu dot org
2004-04-08 18:34 ` bangerth at dealii dot org
2004-04-08 18:53 ` Zack Weinberg
2004-04-08 18:53 ` zack at codesourcery dot com
2004-04-08 19:54 ` gdr at integrable-solutions dot net
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).