From 749ff859eb297807872deacbaee0bd19f187eb91 Mon Sep 17 00:00:00 2001 From: asutton Date: Mon, 1 Sep 2014 17:01:12 +0000 Subject: [PATCH] 2014-09-01 Andrew Sutton Fixing normalization in the presence of constructor calls. * gcc/cp/constraint.cc (normalize_misc): Handle constructor expressions. * gcc/testsuite/g++.dg/concepts/req7.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/c++-concepts@214802 138bc75d-0d04-0410-961f-82ee72b054a4 --- ChangeLog.concepts | 7 +++++++ gcc/cp/constraint.cc | 3 ++- gcc/testsuite/g++.dg/concepts/req7.C | 25 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/concepts/req7.C diff --git a/ChangeLog.concepts b/ChangeLog.concepts index 246e7b1436f..7db4c651305 100644 --- a/ChangeLog.concepts +++ b/ChangeLog.concepts @@ -1,3 +1,10 @@ +2014-09-01 Andrew Sutton + + Fixing normalization in the presence of constructor calls. + * gcc/cp/constraint.cc (normalize_misc): Handle constructor + expressions. + * gcc/testsuite/g++.dg/concepts/req7.C: New. + 2014-08-29 Andrew Sutton Fixing partial-template-id bug. diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index e703915a907..c09d2123547 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -390,9 +390,10 @@ normalize_misc (tree t) { switch (TREE_CODE (t)) { - // Errors and traits are atomic. + // All of these are atomic. case ERROR_MARK: case TRAIT_EXPR: + case CONSTRUCTOR: return t; case STATEMENT_LIST: diff --git a/gcc/testsuite/g++.dg/concepts/req7.C b/gcc/testsuite/g++.dg/concepts/req7.C new file mode 100644 index 00000000000..dd66b39a52e --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/req7.C @@ -0,0 +1,25 @@ +// { dg-options "-std=c++1z" } + +#include + +using namespace std; + +template + struct Sequence : std::false_type { }; + +template + struct Predicate : std::false_type { }; + +template + requires Sequence{} and Predicate{} + bool all(const Seq& seq, Fn fn) { + for(const auto& x : seq) + if (not fn(x)) + return false; + return true; + } + +int main() { + all(vector{0, 2}, true); // { dg-error "cannot call" } +} + -- 2.11.4.GIT