aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-23 16:51:22 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-05-23 16:51:22 -0400
commit39bde5eae367fc1e57d277ea4496c485a3b9c09c (patch)
tree328bd7d8b0c52a07236e22cfca2409b5dff3e30e /gcc
parent46aeac1b9f62be85dcfa7f6a0396440dbe10f321 (diff)
downloadgcc-39bde5eae367fc1e57d277ea4496c485a3b9c09c.zip
gcc-39bde5eae367fc1e57d277ea4496c485a3b9c09c.tar.gz
gcc-39bde5eae367fc1e57d277ea4496c485a3b9c09c.tar.bz2
re PR c++/57388 ([C++11] ICE when function types with ref-qualifiers meet other function types)
PR c++/57388 * tree.c (build_ref_qualified_type): Clear FUNCTION_RVALUE_QUALIFIED for lvalue ref-qualifier. From-SVN: r199269
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/ref-qual13.C29
3 files changed, 38 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7025f34..885d4c9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2013-05-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/57388
+ * tree.c (build_ref_qualified_type): Clear
+ FUNCTION_RVALUE_QUALIFIED for lvalue ref-qualifier.
+
2013-05-22 Jason Merrill <jason@redhat.com>
PR c++/56930
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 9c324e3..0fbb33d 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1769,8 +1769,10 @@ build_ref_qualified_type (tree type, cp_ref_qualifier rqual)
{
case REF_QUAL_RVALUE:
FUNCTION_RVALUE_QUALIFIED (t) = 1;
- /* Intentional fall through */
+ FUNCTION_REF_QUALIFIED (t) = 1;
+ break;
case REF_QUAL_LVALUE:
+ FUNCTION_RVALUE_QUALIFIED (t) = 0;
FUNCTION_REF_QUALIFIED (t) = 1;
break;
default:
diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual13.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual13.C
new file mode 100644
index 0000000..84d3b0f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual13.C
@@ -0,0 +1,29 @@
+// PR c++/57388
+// { dg-require-effective-target c++11 }
+
+template<class> struct A
+{
+ static constexpr bool value = false;
+};
+
+template<class Res, class... Args>
+struct A<Res(Args...)>
+{
+ static constexpr bool value = true;
+};
+
+template<class Res, class... Args>
+struct A<Res(Args...) const &>
+{
+ static constexpr bool value = true;
+};
+
+template<class Res, class... Args>
+struct A<Res(Args...) const &&>
+{
+ static constexpr bool value = true;
+};
+
+static_assert(A<void()>::value, "Ouch");
+static_assert(A<void() const &>::value, ""); // #1
+static_assert(A<void() const &&>::value, ""); // #2