aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2019-04-26 11:46:15 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2019-04-26 11:46:15 +0000
commitaaa94b3c890f4b43ecb8f1134ea0e4c6af75768d (patch)
tree1c0dc97096e1ef610e7fb02c21bef827aed38732
parent849ab78ab0d022202a5b09163bbdfcc2375aeb74 (diff)
downloadgcc-aaa94b3c890f4b43ecb8f1134ea0e4c6af75768d.zip
gcc-aaa94b3c890f4b43ecb8f1134ea0e4c6af75768d.tar.gz
gcc-aaa94b3c890f4b43ecb8f1134ea0e4c6af75768d.tar.bz2
decl.c (grokdeclarator): Fix value assigned to typespec_loc, use min_location.
/cp 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com> * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use min_location. /testsuite 2018-04-26 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/trailing1.C: New. From-SVN: r270597
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/trailing1.C5
4 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 059a7fd..c78683d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
+ min_location.
+
2019-04-24 Jason Merrill <jason@redhat.com>
PR c++/90227 - error with template parameter packs.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 01c89cd..49ab387 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10417,8 +10417,8 @@ grokdeclarator (const cp_declarator *declarator,
location_t typespec_loc = smallest_type_quals_location (type_quals,
declspecs->locations);
- if (typespec_loc == UNKNOWN_LOCATION)
- typespec_loc = declspecs->locations[ds_type_spec];
+ typespec_loc = min_location (typespec_loc,
+ declspecs->locations[ds_type_spec]);
if (typespec_loc == UNKNOWN_LOCATION)
typespec_loc = input_location;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 90e8d8b..13416da 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-26 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/diagnostic/trailing1.C: New.
+
2019-04-26 Richard Sandiford <richard.sandiford@arm.com>
* gcc.dg/alias-16.c: New test.
diff --git a/gcc/testsuite/g++.dg/diagnostic/trailing1.C b/gcc/testsuite/g++.dg/diagnostic/trailing1.C
new file mode 100644
index 0000000..369781e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/trailing1.C
@@ -0,0 +1,5 @@
+// { dg-do compile { target c++11 } }
+
+int const foo1() -> double; // { dg-error "1:.foo1. function with trailing return type" }
+int volatile foo2() -> double; // { dg-error "1:.foo2. function with trailing return type" }
+int const volatile foo3() -> double; // { dg-error "1:.foo3. function with trailing return type" }