Skip to content

constant pragma doesn't warn on redefinition of a list constant #20742

Closed
@djerius

Description

@djerius

Module: constant

Description

Redefining a list constant does not produce a warning.

Steps to Reproduce

This redefinition of a scalar constant warns:

$ perl -Mconstant=Scalar,1  -Mconstant=Scalar,4 -E 'say join ", ", Scalar'
Constant subroutine main::Scalar redefined at .../5.36.0/lib/perl5/5.36.0/constant.pm line 171.
4

But this redefinition of a list one doesn't:

$ perl -Mconstant=List,1,2,3  -Mconstant=List,4,5,6 -E 'say join ", ", List'
4, 5, 6

Expected behavior

I expected to see a warning when redefining the list constant.

Perl configuration

Summary of my perl5 (revision 5 version 36 subversion 0) configuration:
   
  Platform:
    osname=linux
    osvers=5.10.0-14-amd64
    archname=x86_64-linux
    uname='linux leafhopper 5.10.0-14-amd64 #1 smp debian 5.10.113-1 (2022-04-29) x86_64 gnulinux '
    config_args='-Dprefix=/home/dj/.plenv/versions/5.36.0 -de -Dversiononly -A'eval:scriptdir=/home/dj/.plenv/versions/5.36.0/bin''
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='10.2.1 20210110'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.31.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.31'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_TIMES
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Built under linux
  Compiled at May 31 2022 10:50:24
  %ENV:
    PERL_CPANM_OPT="--cascade-search --mirror-only  --mirror /home/dj/Work/darkpan --mirror http://www.cpan.org"
    PERL_CPAN_MIRROR_TINY_BASE="/home/dj/Work/darkpan"
  @INC:
    /home/dj/.plenv/versions/5.36.0/lib/perl5/site_perl/5.36.0/x86_64-linux
    /home/dj/.plenv/versions/5.36.0/lib/perl5/site_perl/5.36.0
    /home/dj/.plenv/versions/5.36.0/lib/perl5/5.36.0/x86_64-linux
    /home/dj/.plenv/versions/5.36.0/lib/perl5/5.36.0



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