public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67825] New: [concepts] expression constraint bug when taking address of a member function
@ 2015-10-02 20:22 ryan.burn at gmail dot com
  2020-04-04  5:02 ` [Bug c++/67825] " jason at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ryan.burn at gmail dot com @ 2015-10-02 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67825
           Summary: [concepts] expression constraint bug when taking
                    address of a member function
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code prints 1 but &A::operator() is an invalid expression so it
should print 0.

///////////////////////////////////////////
#include <iostream>

struct A {
  template <class T>
  double operator()(T x) const {
    return 0;
  }
};

template <class X> concept bool C() {
  return requires {
    &X::operator();
  };
}

int main() {
  std::cout << C<A>() << '\n';
  return 0;
}
///////////////////////////////////////////


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

* [Bug c++/67825] [concepts] expression constraint bug when taking address of a member function
  2015-10-02 20:22 [Bug c++/67825] New: [concepts] expression constraint bug when taking address of a member function ryan.burn at gmail dot com
@ 2020-04-04  5:02 ` jason at gcc dot gnu.org
  2020-04-04 15:07 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2020-04-04  5:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Last reconfirmed|                            |2020-04-04
     Ever confirmed|0                           |1

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

* [Bug c++/67825] [concepts] expression constraint bug when taking address of a member function
  2015-10-02 20:22 [Bug c++/67825] New: [concepts] expression constraint bug when taking address of a member function ryan.burn at gmail dot com
  2020-04-04  5:02 ` [Bug c++/67825] " jason at gcc dot gnu.org
@ 2020-04-04 15:07 ` cvs-commit at gcc dot gnu.org
  2020-04-04 22:37 ` jason at gcc dot gnu.org
  2020-04-22  2:29 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-04 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:f1ad7bac76b662577e3bde78c530954099361a66

commit r10-7554-gf1ad7bac76b662577e3bde78c530954099361a66
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Apr 4 11:04:55 2020 -0400

    c++: Fix invalid pointer-to-member in requires [PR67825]

    A recent change to cmcstl2 led to two tests failing due to this bug: our
    valid expression checking in the context of a requires-expression wasn't
    catching that an expression of member function type can only appear as the
    function operand of a call expression.  Fixed by using convert_to_void to
do
    the same checking as a discarded-value expression.

    This patch also fixes 67825, which already had a testcase, but the testcase
    was testing for the wrong behavior.

    gcc/cp/ChangeLog
    2020-04-04  Jason Merrill  <jason@redhat.com>

            PR c++/67825
            * constraint.cc (tsubst_valid_expression_requirement): Call
            convert_to_void.

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

* [Bug c++/67825] [concepts] expression constraint bug when taking address of a member function
  2015-10-02 20:22 [Bug c++/67825] New: [concepts] expression constraint bug when taking address of a member function ryan.burn at gmail dot com
  2020-04-04  5:02 ` [Bug c++/67825] " jason at gcc dot gnu.org
  2020-04-04 15:07 ` cvs-commit at gcc dot gnu.org
@ 2020-04-04 22:37 ` jason at gcc dot gnu.org
  2020-04-22  2:29 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2020-04-04 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.0
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Actually fixed for GCC 10.

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

* [Bug c++/67825] [concepts] expression constraint bug when taking address of a member function
  2015-10-02 20:22 [Bug c++/67825] New: [concepts] expression constraint bug when taking address of a member function ryan.burn at gmail dot com
                   ` (2 preceding siblings ...)
  2020-04-04 22:37 ` jason at gcc dot gnu.org
@ 2020-04-22  2:29 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-22  2:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:05f14938111e34edd272628a9268444256735e10

commit r10-7862-g05f14938111e34edd272628a9268444256735e10
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Apr 21 22:18:50 2020 -0400

    c++: Diagnose invalid use of member function in requires

    This updates diagnose_valid_expression to mirror the convert_to_void check
added
    to tsubst_valid_expression_requirement by r10-7554.

    gcc/cp/ChangeLog:

            PR c++/67825
            * constraint.cc (diagnose_valid_expression): Check convert_to_void
here
            as well as in tsubst_valid_expression_requirement.

    gcc/testsuite/ChangeLog:

            PR c++/67825
            * g++.dg/concepts/diagnostic10.C: New test.
            * g++.dg/cpp2a/concepts-pr67178.C: Adjust dg-message.

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

end of thread, other threads:[~2020-04-22  2:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02 20:22 [Bug c++/67825] New: [concepts] expression constraint bug when taking address of a member function ryan.burn at gmail dot com
2020-04-04  5:02 ` [Bug c++/67825] " jason at gcc dot gnu.org
2020-04-04 15:07 ` cvs-commit at gcc dot gnu.org
2020-04-04 22:37 ` jason at gcc dot gnu.org
2020-04-22  2:29 ` cvs-commit at gcc dot gnu.org

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