public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "luto at mit dot edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57746] rejected valid specialization of member function of class template (I think)
Date: Tue, 02 Jul 2013 00:04:00 -0000	[thread overview]
Message-ID: <bug-57746-4-NJQxtYPqCl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57746-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Andy Lutomirski <luto at mit dot edu> ---
Daniel, I'm unconvinced that your interpretation is the intended one. 
[temp.explicit].4 says "A declaration of [list including member function] ... A
definition of [list not including member function]".  If definitions were
intended to be declarations in this context, then the second part would be
redundant, I think.

Regardless, the interesting case is:

template<typename T>
struct X
{
  static int val;
  static void func();
};

// optionally: extern template struct X<int>;

void something()
{
  X<int>::func();
}

in one file and

struct X
{
  static int val;
  static void func();
};

template<> void X<int>::func() {}

in another.  I don't think this is an odr violation, since there is only one
definition of anything that could be confused with X<int>::func.  g++ will
happily compile and link it (without the extern template bit) and it will work.
 It is supposed to?  Could a conforming compiler mangle the specialized version
of func differently?


  parent reply	other threads:[~2013-07-02  0:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 23:43 [Bug c++/57746] New: " luto at mit dot edu
2013-06-29 13:11 ` [Bug c++/57746] " daniel.kruegler at googlemail dot com
2013-06-30 12:38 ` redi at gcc dot gnu.org
2013-06-30 12:50 ` daniel.kruegler at googlemail dot com
2013-07-02  0:04 ` luto at mit dot edu [this message]
2013-07-02 18:30 ` luto at mit dot edu
2013-07-02 21:03 ` daniel.kruegler at googlemail dot com
2021-08-02  3:16 ` [Bug c++/57746] Invalid specializations of member objects are accepted, unlike member functions pinskia at gcc dot gnu.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=bug-57746-4-NJQxtYPqCl@http.gcc.gnu.org/bugzilla/ \
    --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).