public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Casey at Carter dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/67150] New: [c++-concepts] Expression constraint fails with dependent types
Date: Fri, 07 Aug 2015 22:01:00 -0000	[thread overview]
Message-ID: <bug-67150-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 67150
           Summary: [c++-concepts] Expression constraint fails with
                    dependent types
           Product: gcc
           Version: c++-concepts
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Casey at Carter dot net
  Target Milestone: ---

r226725 fails to compile this program:

#include <type_traits>

template <class From, class To>
concept bool ExplicitlyConvertible =
  requires (From&& val) {
    requires std::is_same<From,bool>::value;
    requires std::is_same<To,bool>::value;
    requires std::is_same<decltype(val),bool&&>::value;
    static_cast<bool>((bool&&)val); // Line 9
    static_cast<To>((From&&)val);   // Line 10
  };

template <class T>
concept bool Boolean =
  requires (const T& t) {
    { t } -> ExplicitlyConvertible<bool>;
  };

constexpr bool f(Boolean) { return true; } // Line 19
static_assert(f(true));                    // Line 20

with error:

~/concept-gcc-r226725/bin/g++ -std=gnu++1z foo.cpp -c
foo.cpp:20:21: error: cannot call function ‘constexpr bool f(auto:1) [with
auto:1 = bool]’
 static_assert(f(true));                    // Line 20
                     ^
foo.cpp:19:16: note:   constraints not satisfied
 constexpr bool f(Boolean) { return true; } // Line 19
                ^
foo.cpp:19:16: note:   concept ‘Boolean<bool>’ was not satisfied

It does compile correctly if line 10 is commented out, demonstrating that the
expression "static_cast<To>((From&&)val)" is causing the constraint
dissatisfaction despite the fact that From is bool, To is bool, and
"static_cast<bool>((bool&&)val)" is acceptable.
>From gcc-bugs-return-494383-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Aug 07 22:13:48 2015
Return-Path: <gcc-bugs-return-494383-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 110460 invoked by alias); 7 Aug 2015 22:13:47 -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 110425 invoked by uid 48); 7 Aug 2015 22:13:40 -0000
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/48997] Don't use allocatable arrays for function elimination
Date: Fri, 07 Aug 2015 22:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: mikael at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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: cc
Message-ID: <bug-48997-4-ddK4zU7cYt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-48997-4@http.gcc.gnu.org/bugzilla/>
References: <bug-48997-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: 2015-08/txt/msg00525.txt.bz2
Content-length: 413

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> ---
Thomas, what is the status of this?


                 reply	other threads:[~2015-08-07 22:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-67150-4@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).