diff options
-rw-r--r-- | gcc/opts-common.cc | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/pr115440.C | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc index 2d1e86f..9bc03e0 100644 --- a/gcc/opts-common.cc +++ b/gcc/opts-common.cc @@ -524,6 +524,7 @@ add_misspelling_candidates (auto_vec<char *> *candidates, for (unsigned i = 0; i < ARRAY_SIZE (option_map); i++) { const char *opt0 = option_map[i].opt0; + const char *opt1 = option_map[i].opt1; const char *new_prefix = option_map[i].new_prefix; size_t new_prefix_len = strlen (new_prefix); @@ -532,8 +533,9 @@ add_misspelling_candidates (auto_vec<char *> *candidates, if (strncmp (opt_text, new_prefix, new_prefix_len) == 0) { - char *alternative = concat (opt0 + 1, opt_text + new_prefix_len, - NULL); + char *alternative + = concat (opt0 + 1, opt1 ? " " : "", opt1 ? opt1 : "", + opt_text + new_prefix_len, NULL); candidates->safe_push (alternative); } } diff --git a/gcc/testsuite/g++.dg/cpp1z/pr115440.C b/gcc/testsuite/g++.dg/cpp1z/pr115440.C new file mode 100644 index 0000000..788d480 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/pr115440.C @@ -0,0 +1,8 @@ +// PR driver/115440 +// { dg-do compile { target c++17_only } } +// { dg-options "--c++17" } + +int i; + +// { dg-bogus "unrecognized command-line option '--c\\\+\\\+17'; did you mean '--stdc\\\+\\\+17'" "" { target *-*-* } 0 } +// { dg-error "unrecognized command-line option '--c\\\+\\\+17'" "" { target *-*-* } 0 } |