public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/17011] [3.4/3.5 regression] invalid default parameter diagnosed too late
Date: Thu, 12 Aug 2004 23:59:00 -0000	[thread overview]
Message-ID: <20040812235948.30391.qmail@sourceware.org> (raw)
In-Reply-To: <20040812193920.17011.reichelt@gcc.gnu.org>


------- Additional Comments From bangerth at dealii dot org  2004-08-12 23:59 -------
No, the type of &a is of course the same as the type of &this->a, i.e. 
a pointer to an object, not a pointer-to-member. For that you would 
have to use &B<T>::a. The invalid part in the code Volker showed is 
the implicit reference to this->, which is explicitly not allowed 
by the standard. 
 
One of the reasons why you may not want to parse default arguments 
at template definition time is that you cannot know whether this code, 
for example, is going to be valid or not: 
------------------ 
template <typename T> struct X { 
    int g (int = T(1)); 
}; 
------------------ 
(Think a template type T for which there is no constructor that takes 
an integer.) Now, you will say that here we have a dependent call, whereas 
in the original case we do not, but that may actually be hard to 
figure out in some cases. I guess that it's cases like these that led 
the committee to suggest that default arguments are only evaluated at the 
time of use. 
 
W. 

-- 


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


  parent reply	other threads:[~2004-08-12 23:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-12 19:39 [Bug c++/17011] New: " reichelt at gcc dot gnu dot org
2004-08-12 19:40 ` [Bug c++/17011] " reichelt at gcc dot gnu dot org
2004-08-12 21:12 ` bangerth at dealii dot org
2004-08-12 22:21 ` mark at codesourcery dot com
2004-08-12 22:55 ` giovannibajo at libero dot it
2004-08-12 23:59 ` bangerth at dealii dot org [this message]
2004-10-07 16:23 ` [Bug c++/17011] [3.4/4.0 " pinskia at gcc dot gnu dot org
2004-10-12 12:48 ` pinskia at gcc dot gnu dot org
2004-11-01  0:45 ` mmitchel at gcc dot gnu dot org
2004-11-28  6:04 ` lerdsuwa at gcc dot gnu dot org
2004-12-03 10:24 ` lerdsuwa at gcc dot gnu dot org
2004-12-04  6:45 ` cvs-commit at gcc dot gnu dot org
2004-12-04  6:55 ` cvs-commit at gcc dot gnu dot org
2004-12-04  7:06 ` lerdsuwa at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040812235948.30391.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).