commit 0914d39b7335966f5d828c1b4225beb2e5448755
Author: Jason Merrill <jason@redhat.com>
Date: Thu May 23 14:01:27 2013 -0400
PR c++/57388
* tree.c (build_ref_qualified_type): Clear
FUNCTION_RVALUE_QUALIFIED for lvalue ref-qualifier.
@@ -1754,8 +1754,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:
new file mode 100644
@@ -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