@@ -10424,8 +10424,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;
new file mode 100644
@@ -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" }