+2020-05-08 Nathan Sidwell <nathan@acm.org>
+
+ * parser.c (cp_lexer_set_source_position_from_token): EOF has a
+ location too.
+
2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
PR c++/94817
static inline void
cp_lexer_set_source_position_from_token (cp_token *token)
{
- if (token->type != CPP_EOF)
- {
- input_location = token->location;
- }
+ input_location = token->location;
}
/* Update the globals input_location and the input file stack from LEXER. */
+2020-05-08 Nathan Sidwell <nathan@acm.org>
+
+ * c-c++-common/raw-string-6.c: Adjust EOF error location.
+ * g++.dg/cpp0x/decltype63.C: Likewise.
+ * g++.dg/cpp0x/gen-attrs-64.C: Likewise.
+ * g++.dg/cpp0x/pr68726.C: Likewise.
+ * g++.dg/cpp0x/pr78341.C: Likewise.
+ * g++.dg/cpp1y/pr65202.C: Likewise.
+ * g++.dg/cpp1z/class-deduction44.C: Likewise.
+ * g++.dg/diagnostic/unclosed-extern-c.C: Likewise.
+ * g++.dg/diagnostic/unclosed-function.C: Likewise.
+ * g++.dg/diagnostic/unclosed-namespace.C: Likewise.
+ * g++.dg/diagnostic/unclosed-struct.C: Likewise.
+ * g++.dg/ext/pr84598.C: Likewise.
+ * g++.dg/other/switch4.C: Likewise.
+ * g++.dg/parse/crash10.C: Likewise.
+ * g++.dg/parse/crash18.C: Likewise.
+ * g++.dg/parse/crash35.C: Likewise.
+ * g++.dg/parse/crash59.C: Likewise.
+ * g++.dg/parse/crash61.C: Likewise.
+ * g++.dg/parse/crash67.C: Likewise.
+ * g++.dg/parse/ctor3.C: Likewise.
+ * g++.dg/parse/error14.C: Likewise.
+ * g++.dg/parse/error5.C: Likewise.
+ * g++.dg/parse/error56.C: Likewise.
+ * g++.dg/parse/invalid1.C: Likewise.
+ * g++.dg/parse/parameter-declaration-1.C: Likewise.
+ * g++.dg/parse/parser-pr28152-2.C: Likewise.
+ * g++.dg/parse/parser-pr28152.C: Likewise.
+ * g++.dg/parse/pr68722.C: Likewise.
+ * g++.dg/pr46852.C: Likewise.
+ * g++.dg/pr46868.C: Likewise.
+ * g++.dg/template/crash115.C: Likewise.
+ * g++.dg/template/crash43.C: Likewise.
+ * g++.dg/template/error-recovery1.C: Likewise.
+ * g++.dg/template/error57.C: Likewise.
+ * g++.old-deja/g++.other/crash31.C: Likewise.
+
2020-05-08 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/addr15.adb: New test.
// { dg-options "-std=gnu99" { target c } }
// { dg-options "-std=c++0x" { target c++ } }
-const void *s0 = R"ouch()ouCh"; // { dg-error "at end of input" "end" }
- // { dg-error "unterminated raw string" "unterminated" { target *-*-* } .-1 }
+const void *s0 = R"ouch()ouCh"; // { dg-error "unterminated raw string" "unterminated" }
+// { dg-error "at end of input" "end" { target c } .-1 }
+// { dg-error "-:at end of input" "end" { target c++ } .+1 }
template<typename T>
class C{
T t;
- decltype(t)::a:: // { dg-error "expected" }
+ decltype(t)::a:: // { dg-error "expected" }
+// { dg-error "-:expected" }
// PR c++/85140
// { dg-do compile { target c++11 } }
-namespace alignas() N {} // { dg-error "expected" }
+namespace alignas() N {} // { dg-error "expected" }
+// { dg-error "-:expected" }
template <typename, > struct __construct_helper; // { dg-error "expected" }
template <typename... _Args>
using __has_construct typename __construct_helper<_Args...>::type; // { dg-error "expected" }
-} struct : A<int> { // { dg-error "expected" }
+} struct : A<int> { // { dg-error "expected" }
+ // { dg-error "-:expected" }
// PR c++/78341
// { dg-do compile { target c++11 } }
-alignas (alignas double // { dg-error "" }
+alignas (alignas double // { dg-error "expected" }
+// { dg-error "-:expected" }
{
foo<ns::bar> f;
adl::swap(f, f) // { dg-error "expected ';'" }
-} // { dg-error "expected '.'" "expected end of namespace" }
+}
+// { dg-error "-:expected '.'" "expected end of namespace" }
// { dg-do compile { target c++17 } }
template <typename> struct A;
-template <typename> struct B : A < B { , // { dg-error "" }
+template <typename> struct B : A < B { , // { dg-error "" }
+// { dg-error "-:expected" }
void bar (void);
// { dg-message "1: 'extern .C.' linkage started here" "" { target *-*-* } open_extern_c }
-void test (void); /* { dg-error "17: expected '.' at end of input" } */
+void test (void);
// { message "12: to match this '.'" "" { target *-*-* } open_extern_c }
+/* { dg-error "-:expected '.' at end of input" } */
void test (void)
{ /* { dg-message "1: to match this '.'" } */
- int filler; /* { dg-error "13: expected '.' at end of input" } */
+ int filler;
+ /* { dg-error "-:expected '.' at end of input" } */
namespace unclosed { /* { dg-message "20: to match this '.'" } */
-int filler; /* { dg-error "11: expected '.' at end of input" } */
+int filler;
+/* { dg-error "-:expected '.' at end of input" } */
struct unclosed { /* { dg-message "17: to match this '.'" } */
- int dummy; /* { dg-error "12: expected '.' at end of input" } */
- // { dg-error "expected unqualified-id at end of input" "" { target *-*-* } .-1 }
+ int dummy;
+ // { dg-error "-:expected" }
// { dg-options "-fpermissive -w" }
-template<int b> __attribute__ a([] { class c, __attribute__(vector_size(operator+()))) d; // { dg-error "expected" }
+template<int b> __attribute__ a([] { class c, __attribute__(vector_size(operator+()))) d; // { dg-error "" }
+// { dg-error "-:expected" }
void c() {
switch () // { dg-error "expected" }
case b // { dg-error "expected" }
+ // { dg-error "-:expected" }
// PR c++ 10953. ICE
-// { dg-bogus "" "" { target *-*-* } 14 }
-
class
{
typename::
-; // { dg-error "" }
+; // { dg-error "expected" }
+ // { dg-error "-:expected" }
// PR 18095: ICE
// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
-struct A // { dg-error "expected" }
+struct A // { dg-error "-:expected" }
struct a {};
class foo : public a, a // { dg-error "duplicate base" }
-{ /* { dg-error "at end of input" } */
+{ // { dg-error "-:at end of input" }
// PR c++/53003
struct A{ void a{} return b // { dg-error "16:function definition" }
-// { dg-error "expected" "" { target *-*-* } .-1 }
+// { dg-error "-:expected" }
struct pair { constexpr pair (const) : }; // { dg-error "" }
template <0> make_pair () {} // { dg-error "" }
pair prefix[] = { 0, make_pair } // { dg-error "" }
+// { dg-error "-:expected" "" { target c++11 } }
class x0;
template <x1> x2() { // { dg-error "declared|type" }
-x0 x3 = x3. // { dg-error "expected|incomplete type" }
+x0 x3 = x3. // { dg-error "incomplete type" }
+// { dg-error "-:expected" }
struct B : A
{
- B() : A {} // { dg-error "initializer|expected" }
-};
+ B() : A {} // { dg-error "initializer" "" { target c++98_only } }
+}; // { dg-error "expected" }
Zinc<int>( //);
// }
-}; // { dg-error "2:expected '.' at end of input" "at end of input" }
- // { dg-error "1:expected primary-expression before '.' token" "primary" { target *-*-* } .-1 }
- // { dg-error "1:expected unqualified-id" "unqualified-id" { target *-*-* } .-2 }
+}; // { dg-error "1:expected primary-expression before '.' token" "primary" }
+// { dg-error "-:expected" "at end of input" }
// message has been generated by cp_parser_error() which does not
// necessarily allow accurate column number display. At some point, we will
// need make cp_parser_error() report more accurate column numbers.
-// { dg-error "30:expected '\{' at end of input" "brace" { target *-*-* } 5 }
+// { dg-error "31:expected '\{' at end of input" "brace" { target *-*-* } 5 }
// { dg-error "34:expected ';' after class definition" "semicolon" {target *-*-* } 5 }
template <0> int __copy_streambufs_eof; // { dg-error "" }
class {
+// { dg-error "forbids" "" { target *-*-* } .+1 }
friend __copy_streambufs_eof <> ( // { dg-error "" }
+ // { dg-error "-:expected" }
// { dg-do compile { target c++11 } }
// { dg-options "-w" }
-int foo ( foo += *[ // { dg-error "" }
+int foo ( foo += *[ // { dg-error "expected" }
+// { dg-error "-:invalid|expected" }
// { dg-do compile }
struct {
- a(void = 0; a(0), a(0) // { dg-error "" }
+ a(void = 0; a(0), a(0) // { dg-error "" }
+// { dg-error "-:expected" }
z = __complex__ (1.90000007326203904e+19, 0.0); // { dg-error "expected primary-expression before '__complex__'" "primary-expression" }
z = __complex__ (1.0e+0, 0.0) / z; // { dg-error "expected primary-expression before '__complex__'" "primaty-expression" }
- // { dg-error "at end of input" "end" { target *-*-* } .-1 }
+ // { dg-error "-:at end of input" "end" }
z = _Complex (1.90000007326203904e+19, 0.0); // { dg-error "expected primary-expression before '_Complex'" "primary-expression" }
z = _Complex (1.0e+0, 0.0) / z; // { dg-error "expected primary-expression before '_Complex'" "primary-expression" }
- // { dg-error "at end of input" "end" { target *-*-* } .-1 }
+ // { dg-error "-:at end of input" "end" }
&__loc // { dg-error "" }
} class ios_base { // { dg-error "" }
A _M_ios_locale ios_base(ios_base &) template <_Traits> class basic_ios { // { dg-error "" }
-basic_ios basic_ios = operator= // { dg-error "" }
-
+ basic_ios basic_ios = operator= // { dg-error "" }
// { dg-prune-output "file ends in default argument" }
+// { dg-error "-:expected" }
template
<
class
-{ // { dg-error "" }
+{ // { dg-error "" }
+// { dg-error "-:" }
// { dg-do compile }
template < int > struct S { S < // { dg-error "" }
+ // { dg-error "-:expected" }
// PR c++/56534
template < struct template rebind < > // { dg-error "expected|must follow" }
+// { dg-error "-:expected" }
template<typename _Tp> // { dg-error "C" }
struct ___is_pod {
enum {
- __value = (sizeof(__gnu_internal::__test_type<_Tp>(0)))}; // { dg-error "declared|expected" }
-
+ __value = (sizeof(__gnu_internal::__test_type<_Tp>(0)))}; // { dg-error "expected|declared" }
+// { dg-error "-:expected" }
template < typename >
template < bool > struct T < S > // { dg-error "" }
{
- void f () { // { dg-error "" }
+ void f () { // { dg-error "expected" }
+// { dg-error "-:expected" }
template <int()> struct a;
template <int(b)> a < b // { dg-error "int" }
-// { dg-error "expected" "" { target *-*-* } .-1 }
+// { dg-error "-:expected" }
struct foo
{
foo();
-}; // { dg-error "expected" }
+};
+// { dg-error "-:expected" }