public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17971] New: [3.4/4.0 regression] Invalid default parameter not diagnosed.
@ 2004-10-13 9:38 reichelt at gcc dot gnu dot org
2004-10-13 12:22 ` [Bug c++/17971] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-10-13 9:38 UTC (permalink / raw)
To: gcc-bugs
Since PR 16929 got a little confusing, I'm opening a new PR for the
following problem:
Since gcc 3.4.0 we accept the following invalid code snippet. The invalid
default parameter "a" is not even diagnosed at instantiation time.
(This is different from PT 17011 - also a spin-off from PR16929 -
which is just a QoI issue.)
===========================================
template<typename> struct A {};
template<typename T> struct B
{
A<T> a;
void foo(A<T> = a);
};
template struct B<int>;
===========================================
With 3.3.5 and before we got a decent error message:
bug.cc:7: error: invalid use of member `B<T>::a'
--
Summary: [3.4/4.0 regression] Invalid default parameter not
diagnosed.
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org,mark at codesourcery dot
com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17971
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/17971] [3.4/4.0 regression] Invalid default parameter not diagnosed.
2004-10-13 9:38 [Bug c++/17971] New: [3.4/4.0 regression] Invalid default parameter not diagnosed reichelt at gcc dot gnu dot org
@ 2004-10-13 12:22 ` pinskia at gcc dot gnu dot org
2004-10-13 12:50 ` bangerth at dealii dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-13 12:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-13 12:22 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-10-13 12:22:03
date| |
Target Milestone|--- |3.4.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17971
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/17971] [3.4/4.0 regression] Invalid default parameter not diagnosed.
2004-10-13 9:38 [Bug c++/17971] New: [3.4/4.0 regression] Invalid default parameter not diagnosed reichelt at gcc dot gnu dot org
2004-10-13 12:22 ` [Bug c++/17971] " pinskia at gcc dot gnu dot org
@ 2004-10-13 12:50 ` bangerth at dealii dot org
2004-11-01 0:46 ` mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-10-13 12:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-10-13 12:50 -------
I'm not sure this is a bug: the standard quite unmistakably says that
default arguments aren't evaluated unless used. Now, if I try to
use the default argument in your testcase, like so
------------------
template<typename> struct A {};
template<typename T> struct B
{
A<T> a;
void foo(A<T> = a);
};
void bar ()
{
B<int>().foo();
}
--------------------------
then I do get a sensible error:
g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -c x.cc
x.cc:5: error: invalid use of non-static data member `B<int>::a'
x.cc:12: error: from this location
Can you say why the compiler should diagnose this earlier rather than
later, given what the standard says?
For reference:
14.7.2/9 says
An explicit instantiation does not constitute a use of a default
argument, so default argument instantiation is not done. [Example:
char* p = 0;
template<class T> T g(T = &p);
template int g<int>(int); // OK even though &p isn't an int.
--end example]
and there are more places like this.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17971
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/17971] [3.4/4.0 regression] Invalid default parameter not diagnosed.
2004-10-13 9:38 [Bug c++/17971] New: [3.4/4.0 regression] Invalid default parameter not diagnosed reichelt at gcc dot gnu dot org
2004-10-13 12:22 ` [Bug c++/17971] " pinskia at gcc dot gnu dot org
2004-10-13 12:50 ` bangerth at dealii dot org
@ 2004-11-01 0:46 ` mmitchel at gcc dot gnu dot org
2004-11-28 6:03 ` lerdsuwa at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-01 0:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-11-01 00:45 -------
Postponed until GCC 3.4.4.
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.3 |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17971
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/17971] [3.4/4.0 regression] Invalid default parameter not diagnosed.
2004-10-13 9:38 [Bug c++/17971] New: [3.4/4.0 regression] Invalid default parameter not diagnosed reichelt at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-11-01 0:46 ` mmitchel at gcc dot gnu dot org
@ 2004-11-28 6:03 ` lerdsuwa at gcc dot gnu dot org
2004-12-03 10:25 ` lerdsuwa at gcc dot gnu dot org
2004-12-04 7:07 ` lerdsuwa at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-28 6:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-11-28 06:03 -------
Under investigate.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |lerdsuwa at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17971
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/17971] [3.4/4.0 regression] Invalid default parameter not diagnosed.
2004-10-13 9:38 [Bug c++/17971] New: [3.4/4.0 regression] Invalid default parameter not diagnosed reichelt at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-11-28 6:03 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-03 10:25 ` lerdsuwa at gcc dot gnu dot org
2004-12-04 7:07 ` lerdsuwa at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-03 10:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-12-03 10:25 -------
Patch submitted:
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00255.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17971
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/17971] [3.4/4.0 regression] Invalid default parameter not diagnosed.
2004-10-13 9:38 [Bug c++/17971] New: [3.4/4.0 regression] Invalid default parameter not diagnosed reichelt at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-12-03 10:25 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-04 7:07 ` lerdsuwa at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-04 7:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-12-04 07:06 -------
Fixed in 3.4 branch and mainline.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17971
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-12-04 7:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-13 9:38 [Bug c++/17971] New: [3.4/4.0 regression] Invalid default parameter not diagnosed reichelt at gcc dot gnu dot org
2004-10-13 12:22 ` [Bug c++/17971] " pinskia at gcc dot gnu dot org
2004-10-13 12:50 ` bangerth at dealii dot org
2004-11-01 0:46 ` mmitchel at gcc dot gnu dot org
2004-11-28 6:03 ` lerdsuwa at gcc dot gnu dot org
2004-12-03 10:25 ` lerdsuwa at gcc dot gnu dot org
2004-12-04 7:07 ` lerdsuwa 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).