public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cludwig at cdc dot informatik dot tu-darmstadt dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/17232] classes and class template specializations treated differently w.r.t. core issue #337 Date: Mon, 30 Aug 2004 16:56:00 -0000 [thread overview] Message-ID: <20040830165612.8378.qmail@sourceware.org> (raw) In-Reply-To: <20040829175551.17232.cludwig@cdc.informatik.tu-darmstadt.de> ------- Additional Comments From cludwig at cdc dot informatik dot tu-darmstadt dot de 2004-08-30 16:56 ------- Subject: Re: classes and class template specializations treated differently w.r.t. core issue #337 On Mon, Aug 30, 2004 at 04:05:26PM -0000, bangerth at dealii dot org wrote: > > So do we agree that the problem in this PR is really this: > - for the non-template, the compiler realizes that B is abstract > and that therefore no array type can exist; it therefore rejects > the template version of g and goes with the general one > - for the template class A, the compiler doesn't realize the > abstractness and therefore goes with the template version of g > Is this indeed the reason the testcase fails? Yes, that's correct. Perhaps the testcase becomes clearer if you change main() into int main() { return g< A<int> >(0) + 2 * g< B >(0) ; } I'd expect the return value 3 since both classes are abstract and (IMO) the second overload should be chosen in both cases according to the resolution of DR#337 and the SFINAE principle. But gcc 3.4.1 returns 2, exhibiting that the compiler chose the overloads g< A<int> >(A<int>(*)[1]) and g< B >(...), > I double-checked that > if I remove the '=0' declaration in the two classes, that the testcase > really succeeds. That's correct behaviour. Once the classes are no longer abstract the substitution T = B and T = A<int> into T(*)[1] yields a valid expression and g(T(*)[1]) can take part in overload resolution. DR#337 does not apply. Since any match is considered better than the ellipsis, g(T(*)[1]) is chosen both for T = B and T = A<int>. Regards Christoph -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17232
next prev parent reply other threads:[~2004-08-30 16:56 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-08-29 17:55 [Bug c++/17232] New: " cludwig at cdc dot informatik dot tu-darmstadt dot de 2004-08-29 17:58 ` [Bug c++/17232] " cludwig at cdc dot informatik dot tu-darmstadt dot de 2004-08-29 18:42 ` bangerth at dealii dot org 2004-08-29 18:57 ` cludwig at cdc dot informatik dot tu-darmstadt dot de 2004-08-30 12:30 ` giovannibajo at libero dot it 2004-08-30 13:22 ` cludwig at cdc dot informatik dot tu-darmstadt dot de 2004-08-30 14:47 ` giovannibajo at libero dot it 2004-08-30 16:05 ` bangerth at dealii dot org 2004-08-30 16:56 ` cludwig at cdc dot informatik dot tu-darmstadt dot de [this message] 2004-08-30 20:10 ` giovannibajo at libero dot it 2004-08-30 20:56 ` bangerth at dealii dot org 2004-08-30 22:12 ` jason at redhat dot com 2004-08-30 23:15 ` giovannibajo at libero dot it 2004-09-06 7:03 ` cludwig at cdc dot informatik dot tu-darmstadt dot de 2004-09-06 13:40 ` giovannibajo at libero dot it 2004-09-06 13:43 ` giovannibajo at libero dot it 2004-09-27 12:02 ` giovannibajo at libero dot it [not found] <bug-17232-4@http.gcc.gnu.org/bugzilla/> 2013-02-27 18:03 ` jason at gcc dot gnu.org 2013-03-17 2:37 ` jason at gcc dot gnu.org 2013-03-17 20:32 ` jason at gcc dot gnu.org 2013-03-23 17:08 ` jason at gcc dot gnu.org 2013-04-09 1:30 ` jason at gcc dot gnu.org 2014-04-22 11:37 ` jakub at gcc dot gnu.org 2014-07-16 13:31 ` jakub 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=20040830165612.8378.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: linkBe 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).