public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: mark@codesourcery.com
Cc: gcc-patches@gcc.gnu.org
Subject: Re: C++ PATCH: PR 24389
Date: Mon, 17 Oct 2005 16:21:00 -0000	[thread overview]
Message-ID: <m3ll0sxgge.fsf@uniton.integrable-solutions.net> (raw)
In-Reply-To: <200510162330.j9GNUjIi007303@sethra.codesourcery.com>

Mark Mitchell <mark@codesourcery.com> writes:

| This patch fixes PR c++/24389, which was (yet more) fallout from the
| static data member patch.  The problem here was not, as stated in the
| PR, that we were giving X<0>::n_primes non-weak linkage, but rather
| that we are emitting a definition for X<I>::n_primes, where I was a
| non-type template parameter!  
| 
| The cause was that the C++ standard, in its infinite wisdom, makes a
| non-static data member in a class template non-dependent within the
| scope of that template, so that, for example:
| 
|    template <typename T>
|    struct S {  
|      static const int I = 7; // I is not value-dependent within S<T>
|      void f() { 
|        A<I>::type t; // No "typename" keyword required; this is A<7>. 
|      }
|    };
| 
| As a result, we must play funny games with non-static data members,
| even though we generally never evaluate expressions within
| uninstantiated templates.  In particular, within integral constant
| expressions, we must fold non-dependent expressions.

That was new in C++03, compared to C++98, in search of rule optimizations
in small.  I'm glad we share similar appreciationsof list of special rules
and optimization in small ;-)

-- Gaby

      reply	other threads:[~2005-10-17 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-16 23:30 Mark Mitchell
2005-10-17 16:21 ` Gabriel Dos Reis [this message]

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=m3ll0sxgge.fsf@uniton.integrable-solutions.net \
    --to=gdr@integrable-solutions.net \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mark@codesourcery.com \
    /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).