re PR c++/56450 (ICE with SFINAE when detecting non-static member variable)
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 28 Apr 2013 22:56:44 +0000 (22:56 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 28 Apr 2013 22:56:44 +0000 (22:56 +0000)
/cp
2013-04-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/56450
* semantics.c (finish_decltype_type): Handle COMPOUND_EXPR.

/testsuite
2013-04-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/56450
* g++.dg/cpp0x/decltype52.C: New.

From-SVN: r198381

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype52.C [new file with mode: 0644]

index 39fbc46db44db5b81808a996e2cad4069b25a1b3..c614ebed8d7bca74020e3ee6e689f41757add983 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/56450
+       * semantics.c (finish_decltype_type): Handle COMPOUND_EXPR.
+
 2013-04-26  Jakub Jelinek  <jakub@redhat.com>
 
        * error.c (cp_print_error_function): Adjust file_name_as_prefix
index 3566739a10ef8c2864396c7a8c1bd016975cd857..2a0d5bcaded58b40a82d9482d44596fd77ae29c7 100644 (file)
@@ -5398,6 +5398,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
           break;
 
         case COMPONENT_REF:
+       case COMPOUND_EXPR:
          mark_type_use (expr);
           type = is_bitfield_expr_with_lowered_type (expr);
           if (!type)
index cf3465728c06e45767b87ee72a944e5507b87e4f..7e0975d674572d909fc285bc2487a1bcbbfb1405 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/56450
+       * g++.dg/cpp0x/decltype52.C: New.
+
 2013-04-28  Jakub Jelinek  <jakub@redhat.com>
 
        N3472 binary constants
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype52.C b/gcc/testsuite/g++.dg/cpp0x/decltype52.C
new file mode 100644 (file)
index 0000000..e6b5a4c
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/56450
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+T&& declval();
+
+template<typename, typename>
+struct is_same
+{ static constexpr bool value = false; };
+
+template<typename T>
+struct is_same<T, T>
+{ static constexpr bool value = true; };
+
+struct A { static const int dummy = 0; };
+
+static_assert(is_same<decltype(declval<A>().dummy), const int>::value, "");
+static_assert(!is_same<decltype(declval<A>().dummy), const int&>::value, "");