[PATCH] D141283: [clang] Improve diagnostic for "initializer-string for char array is too long"
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 10 13:48:36 PST 2023
shafik accepted this revision.
shafik added a comment.
LGTM
================
Comment at: clang/test/CXX/dcl.decl/dcl.init/dcl.init.string/p2.cpp:2
// RUN: %clang_cc1 -fsyntax-only -verify %s
-char test1[1]="f"; // expected-error {{initializer-string for char array is too long}}
+char test1[1]="f"; // expected-error {{initializer-string for char array is too long, array size is 1 but initializer has size 2 (including the null terminating character)}}
----------------
Can you also add:
```
char test2[1]="";
```
We expect this to succeed
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141283/new/
https://reviews.llvm.org/D141283
More information about the cfe-commits
mailing list