public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor
@ 2005-11-03 15:34 igodard at pacbell dot net
2005-11-03 15:36 ` [Bug c++/24657] " igodard at pacbell dot net
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: igodard at pacbell dot net @ 2005-11-03 15:34 UTC (permalink / raw)
To: gcc-bugs
The first error reported in the attached is:
/home/ivan/ootbc/common/include/bitRow.hh:752: error: argument of type `size_t
(
bitRow<bool, 1u, bigEndian>::)(bitReference<bool, 1u, bigEndian>) const' does
not match `size_t'
Subsequent diagnostics are an ignorable cascade. The constructor is declared
as:
template<size_t count>
bitRow(bitArray<count, T, bitWidth, ordering>& a)
: start(&a[0]), length(count) {}
and the invocation is:
bitArray<256, T, bitWidth, ordering>
data;
bitRow_t bd(data);
which appears innocuous. The type reported in the diagnostic seems completely
bogus to me, and I think that the code is valid in its context :-)
--
Summary: bizarre diagnostic on valid (?) constructor
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24657
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/24657] bizarre diagnostic on valid (?) constructor
2005-11-03 15:34 [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor igodard at pacbell dot net
@ 2005-11-03 15:36 ` igodard at pacbell dot net
2005-11-03 15:36 ` igodard at pacbell dot net
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: igodard at pacbell dot net @ 2005-11-03 15:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from igodard at pacbell dot net 2005-11-03 15:36 -------
Created an attachment (id=10128)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10128&action=view)
source code (compressed)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24657
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/24657] bizarre diagnostic on valid (?) constructor
2005-11-03 15:34 [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor igodard at pacbell dot net
2005-11-03 15:36 ` [Bug c++/24657] " igodard at pacbell dot net
@ 2005-11-03 15:36 ` igodard at pacbell dot net
2005-11-03 16:43 ` igodard at pacbell dot net
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: igodard at pacbell dot net @ 2005-11-03 15:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from igodard at pacbell dot net 2005-11-03 15:36 -------
Created an attachment (id=10127)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10127&action=view)
compiler output
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24657
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/24657] bizarre diagnostic on valid (?) constructor
2005-11-03 15:34 [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor igodard at pacbell dot net
2005-11-03 15:36 ` [Bug c++/24657] " igodard at pacbell dot net
2005-11-03 15:36 ` igodard at pacbell dot net
@ 2005-11-03 16:43 ` igodard at pacbell dot net
2005-11-03 17:04 ` [Bug c++/24657] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: igodard at pacbell dot net @ 2005-11-03 16:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from igodard at pacbell dot net 2005-11-03 16:43 -------
Here's a reduced case:
template<int x> struct B {};
struct A {
template<int i>
A(const B<i>& b) : j(i) {}
void i() {}
int j;
};
int main() {
B<5> b;
A a(b);
}
which gets you:
~/ootbc/members/src$ g++ foo.cc
foo.cc: In constructor `A::A(const B<i>&) [with int i = 5]':
foo.cc:12: instantiated from here
foo.cc:5: error: argument of type `void (A::)()' does not match `int'
The compiler is picking up the member function "i" as the initializer for "j",
rather than the template argument "i". (In the original the template argument
"count" similarly matched a member function name). Yet it has the right "i" in
the constructor's argument type "B<i>", or there would have been an earlier
error.
FWIW, Comeau accepts this code.
Ivan
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24657
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/24657] [3.4/4.0/4.1 Regression] bizarre diagnostic on valid (?) constructor
2005-11-03 15:34 [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor igodard at pacbell dot net
` (2 preceding siblings ...)
2005-11-03 16:43 ` igodard at pacbell dot net
@ 2005-11-03 17:04 ` pinskia at gcc dot gnu dot org
2005-11-08 5:14 ` bangerth at dealii dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-03 17:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2005-11-03 17:04 -------
I tested a few different versions of gcc and added the results to known to
work/fail. 3.3.3 accepted this code. before in 3.2.3 (and below), the error
message was :
t.cc:6: declaration of `void A::i()'
t.cc:4: changes meaning of `i' from `int i'
I don't know if this is valid or not, the issue is a namelookup issue.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|2.95.3 3.0.4 3.4.0 4.0.0 |2.95.3 3.0.4 3.4.0 4.0.0
|4.1.0 |4.1.0 3.2.3
Summary|bizarre diagnostic on valid |[3.4/4.0/4.1 Regression]
|(?) constructor |bizarre diagnostic on valid
| |(?) constructor
Target Milestone|--- |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24657
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/24657] [3.4/4.0/4.1 Regression] bizarre diagnostic on valid (?) constructor
2005-11-03 15:34 [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor igodard at pacbell dot net
` (3 preceding siblings ...)
2005-11-03 17:04 ` [Bug c++/24657] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-11-08 5:14 ` bangerth at dealii dot org
2005-11-08 5:23 ` [Bug c++/24657] [3.4/4.0/4.1 Regression] bizarre diagnostic when a member variable and a template parameter have the same name bangerth at dealii dot org
2005-11-16 19:15 ` gdr at integrable-solutions dot net
6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2005-11-08 5:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from bangerth at dealii dot org 2005-11-08 05:14 -------
This can of course be made even simpler:
----------------
struct A {
template<int i> A(int (*)[i]) : j(i) {}
int * i;
int j;
};
int i[3];
A a(&i);
----------------
g/x> /home/bangerth/bin/gcc-3.4.5-pre/bin/c++ -c x.cc
x.cc: In constructor `A::A(int (*)[i]) [with int i = 3]':
x.cc:8: instantiated from here
x.cc:2: error: invalid conversion from `int*' to `int'
I'm pretty sure I've seen this somewhere before -- the question was indeed
which name should be looked up, the template name or the name of a member
variable.
In any case, the error message is not particularly helpful, and I know of
at least one other compiler that accepts this.
W.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2005-11-08 05:14:36
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24657
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/24657] [3.4/4.0/4.1 Regression] bizarre diagnostic when a member variable and a template parameter have the same name
2005-11-03 15:34 [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor igodard at pacbell dot net
` (4 preceding siblings ...)
2005-11-08 5:14 ` bangerth at dealii dot org
@ 2005-11-08 5:23 ` bangerth at dealii dot org
2005-11-16 19:15 ` gdr at integrable-solutions dot net
6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2005-11-08 5:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from bangerth at dealii dot org 2005-11-08 05:23 -------
This is PR 13967. See in particular comment #11 in the audit trail there.
Not that that PR would be particularly enlightening, but the situation is
at least discussed at length there.
W.
*** This bug has been marked as a duplicate of 13967 ***
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24657
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/24657] [3.4/4.0/4.1 Regression] bizarre diagnostic when a member variable and a template parameter have the same name
2005-11-03 15:34 [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor igodard at pacbell dot net
` (5 preceding siblings ...)
2005-11-08 5:23 ` [Bug c++/24657] [3.4/4.0/4.1 Regression] bizarre diagnostic when a member variable and a template parameter have the same name bangerth at dealii dot org
@ 2005-11-16 19:15 ` gdr at integrable-solutions dot net
6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-11-16 19:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from gdr at integrable-solutions dot net 2005-11-16 19:14 -------
Subject: Re: [3.4/4.0/4.1 Regression] bizarre diagnostic on valid (?)
constructor
"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| I'm pretty sure I've seen this somewhere before -- the question was indeed
| which name should be looked up, the template name or the name of a member
| variable.
Indeed this is an issue. Discussion in on the -core reached the
consensus that we could change the lookup rules for member templates
so that template parameters for *member* templates would be searched,
before members of the enclosing class. But I don't recall the issue
has attained an advanced state yet. Note that in the older "issue",
there actually are TWO separate issues.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24657
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-11-16 19:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-03 15:34 [Bug c++/24657] New: bizarre diagnostic on valid (?) constructor igodard at pacbell dot net
2005-11-03 15:36 ` [Bug c++/24657] " igodard at pacbell dot net
2005-11-03 15:36 ` igodard at pacbell dot net
2005-11-03 16:43 ` igodard at pacbell dot net
2005-11-03 17:04 ` [Bug c++/24657] [3.4/4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-11-08 5:14 ` bangerth at dealii dot org
2005-11-08 5:23 ` [Bug c++/24657] [3.4/4.0/4.1 Regression] bizarre diagnostic when a member variable and a template parameter have the same name bangerth at dealii dot org
2005-11-16 19:15 ` 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).