Don't treat array as builtin type in set_underlying_type
authorJason Merrill <jason@redhat.com>
Tue, 13 Sep 2016 15:56:03 +0000 (11:56 -0400)
committerTom de Vries <vries@gcc.gnu.org>
Tue, 13 Sep 2016 15:56:03 +0000 (15:56 +0000)
2016-09-13  Jason Merrill  <jason@redhat.com>
    Tom de Vries  <tom@codesourcery.com>

PR c++/77427
* c-common.c (set_underlying_type): Don't treat array as builtin type.

* g++.dg/pr77427.C: New test.

Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r240112

gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr77427.C [new file with mode: 0644]

index d7b95dec3249cad852e26363fbca7354b529000b..d8f1808e6998a07c7a2e22c5e82bab7bd8f681fb 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-13  Jason Merrill  <jason@redhat.com>
+           Tom de Vries  <tom@codesourcery.com>
+
+       PR c++/77427
+       * c-common.c (set_underlying_type): Don't treat array as builtin type.
+
 2016-09-13  Jason Merrill  <jason@redhat.com>
 
        * c-common.c (check_cxx_fundamental_alignment_constraints): Don't
index 9fec2cfbc50b7d9226d2b76892e0c5c906948f14..73bd43f8703290e0cf77aa43180f8e80b2bf0441 100644 (file)
@@ -12298,7 +12298,7 @@ set_underlying_type (tree x)
 {
   if (x == error_mark_node)
     return;
-  if (DECL_IS_BUILTIN (x))
+  if (DECL_IS_BUILTIN (x) && TREE_CODE (TREE_TYPE (x)) != ARRAY_TYPE)
     {
       if (TYPE_NAME (TREE_TYPE (x)) == 0)
        TYPE_NAME (TREE_TYPE (x)) = x;
index d9d682577bcfeb6f775366de89dba009124f65a7..2ebe9e68f9074c3f1753866e59b2cf92c0955643 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-13  Jason Merrill  <jason@redhat.com>
+           Tom de Vries  <tom@codesourcery.com>
+
+       PR c++/77427
+       * g++.dg/pr77427.C: New test.
+
 2016-09-13  Martin Liska  <mliska@suse.cz>
 
        * g++.dg/gcov/gcov-threads-1.C: Use profile_update_atomic
diff --git a/gcc/testsuite/g++.dg/pr77427.C b/gcc/testsuite/g++.dg/pr77427.C
new file mode 100644 (file)
index 0000000..544946d
--- /dev/null
@@ -0,0 +1,17 @@
+// { dg-do compile }
+
+void bar (__builtin_va_list &);
+
+struct c
+{
+  operator const __builtin_va_list &();
+  operator __builtin_va_list &();
+};
+
+void
+foo (void)
+{
+  struct c c1;
+
+  bar (c1);
+}