Hi,

as mentioned in one of my last patches, we can now improve this location. Note: in the same function there are a few further issues which I mean to incrementally fix (eg, the diagnostics for warn_if_not_aligned ICEs for unnamed bit-fields). Tested x86_64-linux.

Thanks, Paolo.

////////////////

/cp
2018-12-05  Paolo Carlini  <paolo.carl...@oracle.com>

        * decl2.c (grokbitfield): USe DECL_SOURCE_LOCATION in error message.

/testsuite
2018-12-05  Paolo Carlini  <paolo.carl...@oracle.com>

        * g++.dg/parse/bitfield6b.C: New.
Index: cp/decl2.c
===================================================================
--- cp/decl2.c  (revision 266818)
+++ cp/decl2.c  (working copy)
@@ -1027,7 +1027,8 @@ grokbitfield (const cp_declarator *declarator,
       && (INDIRECT_TYPE_P (value)
           || !dependent_type_p (TREE_TYPE (value))))
     {
-      error ("bit-field %qD with non-integral type", value);
+      error_at (DECL_SOURCE_LOCATION (value),
+               "bit-field %qD with non-integral type", value);
       return error_mark_node;
     }
 
Index: testsuite/g++.dg/parse/bitfield6b.C
===================================================================
--- testsuite/g++.dg/parse/bitfield6b.C (nonexistent)
+++ testsuite/g++.dg/parse/bitfield6b.C (working copy)
@@ -0,0 +1,4 @@
+typedef void a();
+struct A {
+a a1: 1;  // { dg-error "3:bit-field .void A::a1\\(\\). with non-integral 
type" }
+};

Reply via email to