Bug 67240 - [concepts] Implicit conversion constraints are not respected
Summary: [concepts] Implicit conversion constraints are not respected
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-16 18:09 UTC by sebi707
Modified: 2015-08-21 18:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-08-17 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sebi707 2015-08-16 18:09:02 UTC
Using the trailing return type to add constraints does not work in some cases. The following code should not compile:

int foo(int x)
{
    return x;
}
 
template <typename T>
concept bool C1 = requires (T x) {
    {foo(x)} -> int&;
};

template <typename T>
concept bool C2 = requires (T x) {
    {foo(x)} -> void;
};
 
static_assert( C1<int> );
static_assert( C2<int> );

However this compiles just fine with r226884.
Comment 1 Jason Merrill 2015-08-21 18:33:39 UTC
Author: jason
Date: Fri Aug 21 18:33:07 2015
New Revision: 227081

URL: https://gcc.gnu.org/viewcvs?rev=227081&root=gcc&view=rev
Log:
	PR c++/67240
	* constraint.cc (satisfy_implicit_conversion_constraint): Also
	check for NULL_TREE.

Added:
    trunk/gcc/testsuite/g++.dg/concepts/iconv1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constraint.cc
Comment 2 Jason Merrill 2015-08-21 18:33:45 UTC
Fixed.