public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61174] New: [4.9 Regression] Bad resolving of specialized template with const-qualified member function
@ 2014-05-13 13:14 ncornu@aldebaran-robotics.com
  2014-05-13 13:56 ` [Bug c++/61174] " paolo.carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ncornu@aldebaran-robotics.com @ 2014-05-13 13:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61174

            Bug ID: 61174
           Summary: [4.9 Regression] Bad resolving of specialized template
                    with const-qualified member function
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ncornu@aldebaran-robotics.com

Created attachment 32788
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32788&action=edit
A file reproducing the bug

With 4.8 it compiles.

With 4.9.0 we got:
main.cpp: In instantiation of ‘struct A<int (C::*)() const>’:
main.cpp:22:8:   required from ‘void make(T) [with T = int (C::*)() const]’
main.cpp:27:13:   required from here
main.cpp:6:18: attention : invalid application of ‘sizeof’ to a function type
[-Wpointer-arith]
   int fail[sizeof(T) - 1000];
                  ^
main.cpp: In function ‘void make(T) [with T = int (C::*)() const]’:
main.cpp:22:8: erreur: size of variable ‘a’ is too large
   A<T> a;
        ^

Because it use the attribute specialization of our template.
>From gcc-bugs-return-451458-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 13 13:18:09 2014
Return-Path: <gcc-bugs-return-451458-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22844 invoked by alias); 13 May 2014 13:18:08 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22760 invoked by uid 48); 13 May 2014 13:18:03 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61174] Bad resolving of specialized template with const-qualified member function
Date: Tue, 13 May 2014 13:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: short_desc bug_severity
Message-ID: <bug-61174-4-qAtsWPV9vT@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61174-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61174-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg01150.txt.bz2
Content-length: 774

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida174

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.9 Regression] Bad        |Bad resolving of
                   |resolving of specialized    |specialized template with
                   |template with               |const-qualified member
                   |const-qualified member      |function
                   |function                    |
           Severity|major                       |normal

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Pretty sure this is invalid, thus not a regression (clang & SolarisStudio
agree)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61174] Bad resolving of specialized template with const-qualified member function
  2014-05-13 13:14 [Bug c++/61174] New: [4.9 Regression] Bad resolving of specialized template with const-qualified member function ncornu@aldebaran-robotics.com
@ 2014-05-13 13:56 ` paolo.carlini at oracle dot com
  2014-05-13 14:15 ` ncornu@aldebaran-robotics.com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-13 13:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61174

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
By the way, this does *not* compile with 4.8, neither with 4.7, ...


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61174] Bad resolving of specialized template with const-qualified member function
  2014-05-13 13:14 [Bug c++/61174] New: [4.9 Regression] Bad resolving of specialized template with const-qualified member function ncornu@aldebaran-robotics.com
  2014-05-13 13:56 ` [Bug c++/61174] " paolo.carlini at oracle dot com
@ 2014-05-13 14:15 ` ncornu@aldebaran-robotics.com
  2014-05-13 14:18 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ncornu@aldebaran-robotics.com @ 2014-05-13 14:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61174

--- Comment #3 from alkino <ncornu@aldebaran-robotics.com> ---
It works with ideone (gcc-4.8.1) https://ideone.com/t8Jww2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61174] Bad resolving of specialized template with const-qualified member function
  2014-05-13 13:14 [Bug c++/61174] New: [4.9 Regression] Bad resolving of specialized template with const-qualified member function ncornu@aldebaran-robotics.com
  2014-05-13 13:56 ` [Bug c++/61174] " paolo.carlini at oracle dot com
  2014-05-13 14:15 ` ncornu@aldebaran-robotics.com
@ 2014-05-13 14:18 ` paolo.carlini at oracle dot com
  2014-05-13 14:33 ` ncornu@aldebaran-robotics.com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-13 14:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61174

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
But the testcase is invalid.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61174] Bad resolving of specialized template with const-qualified member function
  2014-05-13 13:14 [Bug c++/61174] New: [4.9 Regression] Bad resolving of specialized template with const-qualified member function ncornu@aldebaran-robotics.com
                   ` (2 preceding siblings ...)
  2014-05-13 14:18 ` paolo.carlini at oracle dot com
@ 2014-05-13 14:33 ` ncornu@aldebaran-robotics.com
  2014-05-13 15:03 ` paolo.carlini at oracle dot com
  2014-05-13 20:07 ` ncornu@aldebaran-robotics.com
  5 siblings, 0 replies; 7+ messages in thread
From: ncornu@aldebaran-robotics.com @ 2014-05-13 14:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61174

--- Comment #5 from alkino <ncornu@aldebaran-robotics.com> ---
Can you tell me why, please?

Thanks to look at it.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61174] Bad resolving of specialized template with const-qualified member function
  2014-05-13 13:14 [Bug c++/61174] New: [4.9 Regression] Bad resolving of specialized template with const-qualified member function ncornu@aldebaran-robotics.com
                   ` (3 preceding siblings ...)
  2014-05-13 14:33 ` ncornu@aldebaran-robotics.com
@ 2014-05-13 15:03 ` paolo.carlini at oracle dot com
  2014-05-13 20:07 ` ncornu@aldebaran-robotics.com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-13 15:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61174

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Instead of starting from scratch, why don't you use
std::is_member_function_pointer? It handles correctly all sorts of member
functions. Alternately, study the implementation and learn from it.

In any case, you have of course a problem with the constness of g, you would
have to add:

template<typename C, typename T> struct A<T (C::*)() const>
{
  int ok;
};

because otherwise the first specialization - as you can easily learn from
<type_traits> - matches f and all sorts of member pointers, for that matter.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/61174] Bad resolving of specialized template with const-qualified member function
  2014-05-13 13:14 [Bug c++/61174] New: [4.9 Regression] Bad resolving of specialized template with const-qualified member function ncornu@aldebaran-robotics.com
                   ` (4 preceding siblings ...)
  2014-05-13 15:03 ` paolo.carlini at oracle dot com
@ 2014-05-13 20:07 ` ncornu@aldebaran-robotics.com
  5 siblings, 0 replies; 7+ messages in thread
From: ncornu@aldebaran-robotics.com @ 2014-05-13 20:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61174

--- Comment #7 from alkino <ncornu@aldebaran-robotics.com> ---
I only spot the wrong bug. Here it is: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61182


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-05-13 20:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13 13:14 [Bug c++/61174] New: [4.9 Regression] Bad resolving of specialized template with const-qualified member function ncornu@aldebaran-robotics.com
2014-05-13 13:56 ` [Bug c++/61174] " paolo.carlini at oracle dot com
2014-05-13 14:15 ` ncornu@aldebaran-robotics.com
2014-05-13 14:18 ` paolo.carlini at oracle dot com
2014-05-13 14:33 ` ncornu@aldebaran-robotics.com
2014-05-13 15:03 ` paolo.carlini at oracle dot com
2014-05-13 20:07 ` ncornu@aldebaran-robotics.com

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).