public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures.
@ 2004-05-24 14:42 sbrenneis at surry dot net
2004-05-24 14:47 ` [Bug c++/15624] " sbrenneis at surry dot net
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: sbrenneis at surry dot net @ 2004-05-24 14:42 UTC (permalink / raw)
To: gcc-bugs
Invalid method signatures are generated where parameter types are defined,
particularly inside namespaces (namespace, struct, class).
--
Summary: Defined types lose const qualifiers in certain method
signatures.
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sbrenneis at surry dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/us
GCC host triplet: Fedora Core 1
GCC target triplet: 3.3.2 20031022 (Red Hat Linux 3.3.2-1)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
2004-05-24 14:47 ` [Bug c++/15624] " sbrenneis at surry dot net
@ 2004-05-24 14:47 ` sbrenneis at surry dot net
2004-05-24 22:57 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: sbrenneis at surry dot net @ 2004-05-24 14:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From sbrenneis at surry dot net 2004-05-24 01:05 -------
Created an attachment (id=6366)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6366&action=view)
Test case.
Test case reproduces the bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
@ 2004-05-24 14:47 ` sbrenneis at surry dot net
2004-05-24 14:47 ` sbrenneis at surry dot net
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: sbrenneis at surry dot net @ 2004-05-24 14:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From sbrenneis at surry dot net 2004-05-24 01:08 -------
Command line: g++ gcctest.cc
Compiler output:
gcctest.cc: In function `int main(int, char**)':
gcctest.cc:28: error: invalid conversion from `const char*' to `char*'
gcctest.cc:28: error: initializing argument 1 of `void ScopeTest::test(char*)
'
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
2004-05-24 14:47 ` [Bug c++/15624] " sbrenneis at surry dot net
2004-05-24 14:47 ` sbrenneis at surry dot net
@ 2004-05-24 22:57 ` pinskia at gcc dot gnu dot org
2004-05-25 9:16 ` bangerth at dealii dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 22:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-24 01:33 -------
Here is a smaller example:
typedef char* CharPtr;
void t(const CharPtr);
void f(const char *t1)
{
t(t1);
}
But I think this is invalid.
--
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|../configure --prefix=/usr -|
|-mandir=/usr/share/man -- |
|infodir=/us |
GCC host triplet|Fedora Core 1 |
GCC target triplet|3.3.2 20031022 (Red Hat |
|Linux 3.3.2-1) |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
` (2 preceding siblings ...)
2004-05-24 22:57 ` pinskia at gcc dot gnu dot org
@ 2004-05-25 9:16 ` bangerth at dealii dot org
2004-05-25 14:33 ` sbrenneis at surry dot net
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2004-05-25 9:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-05-24 13:47 -------
'const CharPtr' is a constant pointer to a character.
'const char *' is a pointer to a constant character.
The testcase is therefore invalid code, and gcc is correct
in reporting an error.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
` (3 preceding siblings ...)
2004-05-25 9:16 ` bangerth at dealii dot org
@ 2004-05-25 14:33 ` sbrenneis at surry dot net
2004-05-25 14:45 ` bangerth at dealii dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: sbrenneis at surry dot net @ 2004-05-25 14:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From sbrenneis at surry dot net 2004-05-24 17:46 -------
The error message from gcc, then, is misleading. It fails to indicate any const
qualifier in the method signature. Should this be filed as a separate bug?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
` (4 preceding siblings ...)
2004-05-25 14:33 ` sbrenneis at surry dot net
@ 2004-05-25 14:45 ` bangerth at dealii dot org
2004-05-25 18:35 ` sbrenneis at surry dot net
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2004-05-25 14:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-05-24 17:49 -------
Um, why do you say that? The error message is
invalid conversion from `const char*' to `char*'
which is about as clear as it can be, no?
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
` (5 preceding siblings ...)
2004-05-25 14:45 ` bangerth at dealii dot org
@ 2004-05-25 18:35 ` sbrenneis at surry dot net
2004-05-25 19:32 ` bangerth at dealii dot org
2004-05-26 11:39 ` sbrenneis at surry dot net
8 siblings, 0 replies; 10+ messages in thread
From: sbrenneis at surry dot net @ 2004-05-25 18:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From sbrenneis at surry dot net 2004-05-24 23:10 -------
gcctest.cc:28: error: initializing argument 1 of `void ScopeTest::test(char*)
'
Argument 1 of ScopeTest::test is "const TestTraits::CharPtr". The error message
indicates a misleading error and an invalid method signature, hence the bug
report. As you are technically correct about the error report, gcc should report
"error: invalid conversion from `const char*' to `char const*'" and "error:
initializing argument 1 of void ScopeTest::test(char const*)." While the fact of
the error is correct, the report of the error generated by gcc is incorrect and
misleading.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
` (6 preceding siblings ...)
2004-05-25 18:35 ` sbrenneis at surry dot net
@ 2004-05-25 19:32 ` bangerth at dealii dot org
2004-05-26 11:39 ` sbrenneis at surry dot net
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2004-05-25 19:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-05-25 00:09 -------
No, gcc is still correct since from a language viewpoint, the
following two declarations are exactly identical:
void f(char *);
void f(char *const);
For the argument signature, the const in the second case is irrelevant,
and is thus dropped. You can see this by simply compiling these two
lines above (as a C file; remember that C does not have function
overloading) -- the compiler accepts this as a duplicate declaration,
whereas it does not accept these two lines:
void f(char *);
void f(const char*);
generating an error about conflicting declarations.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/15624] Defined types lose const qualifiers in certain method signatures.
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
` (7 preceding siblings ...)
2004-05-25 19:32 ` bangerth at dealii dot org
@ 2004-05-26 11:39 ` sbrenneis at surry dot net
8 siblings, 0 replies; 10+ messages in thread
From: sbrenneis at surry dot net @ 2004-05-26 11:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From sbrenneis at surry dot net 2004-05-25 13:08 -------
Right you are. I re-read ISO/IEC 14882:1998(E)-8.3.5(3). Thanks for your time
and the discussion.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15624
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-05-25 13:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-24 14:42 [Bug c++/15624] New: Defined types lose const qualifiers in certain method signatures sbrenneis at surry dot net
2004-05-24 14:47 ` [Bug c++/15624] " sbrenneis at surry dot net
2004-05-24 14:47 ` sbrenneis at surry dot net
2004-05-24 22:57 ` pinskia at gcc dot gnu dot org
2004-05-25 9:16 ` bangerth at dealii dot org
2004-05-25 14:33 ` sbrenneis at surry dot net
2004-05-25 14:45 ` bangerth at dealii dot org
2004-05-25 18:35 ` sbrenneis at surry dot net
2004-05-25 19:32 ` bangerth at dealii dot org
2004-05-26 11:39 ` sbrenneis at surry 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).