diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2019-05-14 11:43:55 +0000 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-05-14 11:43:55 +0000 |
commit | 4593483f15ca2a82049500b9434e736996bb0891 (patch) | |
tree | 1db41e29d9b2779229d2b18744399e2df7b9f898 | |
parent | 19eda56db6c7a6aff1064efb49c18734e82eb382 (diff) | |
download | gcc-4593483f15ca2a82049500b9434e736996bb0891.zip gcc-4593483f15ca2a82049500b9434e736996bb0891.tar.gz gcc-4593483f15ca2a82049500b9434e736996bb0891.tar.bz2 |
Reapply r270597.
2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
PR preprocessor/90382
* decl.c (grokdeclarator): Fix value assigned to typespec_loc, use
min_location.
2019-05-14 Paolo Carlini <paolo.carlini@oracle.com>
PR preprocessor/90382
* g++.dg/diagnostic/trailing1.C: New test.
From-SVN: r271164
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/diagnostic/trailing1.C | 5 |
4 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 812f9f5..d896e5d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-05-14 Paolo Carlini <paolo.carlini@oracle.com> + + PR preprocessor/90382 + * decl.c (grokdeclarator): Fix value assigned to typespec_loc, use + min_location. + 2019-05-13 Jason Merrill <jason@redhat.com> Use releasing_vec more broadly. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 86cfcbe..66dc4c4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f5ce72b..bec2168 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-14 Paolo Carlini <paolo.carlini@oracle.com> + + PR preprocessor/90382 + * g++.dg/diagnostic/trailing1.C: New test. + 2019-05-14 marxin <mliska@suse.cz> PR middle-end/90340 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" } |