This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77830] internal compiler error: in output_constructor_regular_field, at varasm.c:4968, when using constexpr (with testcase)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77830

Asad Mehmood <asad78611 at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Asad Mehmood <asad78611 at googlemail dot com> ---
Never mind,

Incorrect source

clang gives a more informative error:

test.cpp:35:18: error: constexpr variable 'a' must be initialized by a constant
expression
  constexpr auto a = create_parser("A","B","C");
                 ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cpp:20:23: note: assignment to dereferenced one-past-the-end pointer is
not allowed in a constant expression
      this->arr[i][j] = 0;
                      ^
test.cpp:29:7: note: in call to '&p->setMember(&"A"[0], 0)'
    p.setMember(strings[i], i);
      ^
test.cpp:35:22: note: in call to 'create_parser(&"A"[0], &"B"[0], &"C"[0])'
  constexpr auto a = create_parser("A","B","C");
                     ^
1 error generated.

error was on line 13: should have been j < 11.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]