From 42763690bd1f536692054d4b8d530d1a5a9c29a1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 13 Sep 2016 11:56:03 -0400 Subject: [PATCH] Don't treat array as builtin type in set_underlying_type 2016-09-13 Jason Merrill Tom de Vries 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 From-SVN: r240112 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-common.c | 2 +- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/pr77427.C | 17 +++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/pr77427.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index d7b95dec324..d8f1808e699 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2016-09-13 Jason Merrill + Tom de Vries + + PR c++/77427 + * c-common.c (set_underlying_type): Don't treat array as builtin type. + 2016-09-13 Jason Merrill * c-common.c (check_cxx_fundamental_alignment_constraints): Don't diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 9fec2cfbc50..73bd43f8703 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d9d682577bc..2ebe9e68f90 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-09-13 Jason Merrill + Tom de Vries + + PR c++/77427 + * g++.dg/pr77427.C: New test. + 2016-09-13 Martin Liska * 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 index 00000000000..544946d70b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr77427.C @@ -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); +} -- 2.30.2