Skip to content

warn about initializers containing more elements than initialized value #10041

@llvmbot

Description

@llvmbot
Bugzilla Link 9669
Resolution FIXED
Resolved on Apr 11, 2011 14:49
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@efriedma-quic,@tkremenek

Extended Description

Hi there, I was wondering if it's sensible to add a compile-time check for out of bounds definitions for arrays like g++ already does for strings.

impulze@localhost ~ $ printf 'int main(){char f[1]="f";}' | g++ -x c++ -
: In function ‘int main()’:
:1:22: error: initializer-string for array of chars is too long

impulze@localhost ~ $ printf 'int main(){char f[1]="f";}' | clang++ -x c++ -

impulze@localhost ~ $ clang ++ --version
clang version 3.0 (/var/cache/paludis/distfiles/scm/clang f65076ebf5e8bc5ae7b77fe3c3a65dc5db8d763f)
Target: x86_64-pc-linux-gnu
Thread model: posix

Not sure if this is maybe related tohttp://llvm.org/bugs/show_bug.cgi?id=5028

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions