/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 28 Apr 2013 22:56:44 +0000 (22:56 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 28 Apr 2013 22:56:44 +0000 (22:56 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198381 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 39fbc46..c614ebe 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 3566739..2a0d5bc 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 cf34657..7e0975d 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, "");