]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Apr 2019 11:46:15 +0000 (11:46 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Apr 2019 11:46:15 +0000 (11:46 +0000)
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.

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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/diagnostic/trailing1.C [new file with mode: 0644]

index 059a7fd0ea6600ecc379a83ae61e59c17b5915df..c78683d3949d1b7842d88726fab9c697fac04873 100644 (file)
@@ -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.
index 01c89cd572d12f9afacc83986568da116e1cbcca..49ab387889608d56ccc1ce6295a62a0b934f3da3 100644 (file)
@@ -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;
 
index 90e8d8b2030df099a442fa5e140b9649a1927bb5..13416da786a533826d5b186e029b35362e82033a 100644 (file)
@@ -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 (file)
index 0000000..369781e
--- /dev/null
@@ -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" }