diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-08 22:01:29 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-08 22:01:29 +0000 |
commit | a1468230c999c7c18b7028d19b443b7f27ce0472 (patch) | |
tree | e2c799f9127cd9e5418f54ff0ee0649b9040aae8 /gcc | |
parent | e09c8342eb6e1347c9dfc4dc95946862541b7dd3 (diff) | |
download | gcc-a1468230c999c7c18b7028d19b443b7f27ce0472.tar.gz |
PR c++/67159
* constraint.cc (finish_template_introduction):
SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226738 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/constraint.cc | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/diagnostic1.C | 16 |
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 32392395a22..f04b15c0f62 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-08-08 Jason Merrill <jason@redhat.com> + PR c++/67159 + * constraint.cc (finish_template_introduction): + SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT. + PR c++/67142 * pt.c (equal): Make sure tmpl is actually a template. diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index cf57cc010a4..c981212271d 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -1337,6 +1337,7 @@ finish_template_introduction (tree tmpl_decl, tree intro_list) tree parm = TREE_VEC_ELT (parm_list, n); TREE_VEC_ELT (check_args, n) = template_parm_to_arg (parm); } + SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (check_args, n); /* If the template expects more parameters we should be able to use the defaults from our deduced concept. */ diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic1.C b/gcc/testsuite/g++.dg/concepts/diagnostic1.C new file mode 100644 index 00000000000..7c360cc3943 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/diagnostic1.C @@ -0,0 +1,16 @@ +// PR c++/67159 +// { dg-options -std=c++1z } + +template <class T> +concept bool R = requires (T& t) { + { t.begin() } -> T +}; + +struct foo { + int* begin(); +}; + +R{T} +constexpr bool f() { return true; } + +static_assert(f<foo>()); // { dg-error "" } |