public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67150] New: [c++-concepts] Expression constraint fails with dependent types
@ 2015-08-07 22:01 Casey at Carter dot net
  0 siblings, 0 replies; only message in thread
From: Casey at Carter dot net @ 2015-08-07 22:01 UTC (permalink / raw)
  To: gcc-bugs

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?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-07 22:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07 22:01 [Bug c++/67150] New: [c++-concepts] Expression constraint fails with dependent types Casey at Carter dot net

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