bugGNU APL - Bugs: bug #67543, error: non-constant-expression...

 
 

bug #67543: error: non-constant-expression cannot be narrowed from type 'Pixel_X' (aka 'short') to 'uint16_t' (aka 'unsigned short')

Submitter:  Ryan Carsten Schmidt <ryandesign>
Submitted:  Tue 23 Sep 2025 03:45:47 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Tue 23 Sep 2025 03:45:47 AM UTC, original submission:  

apl 1.9 fails to build on macOS 15 (with Xcode command line tools 16.4, which has a clang based on LLVM 19):


Plot_xcb.cc:557:27: error: non-constant-expression cannot be narrowed from type 'Pixel_X' (aka 'short') to 'uint16_t' (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
  557 |                           point_size, point_size,            // diameters
      |                           ^~~~~~~~~~
Plot_xcb.cc:557:27: note: insert an explicit cast to silence this issue
  557 |                           point_size, point_size,            // diameters
      |                           ^~~~~~~~~~
      |                           static_cast<uint16_t>( )
Plot_xcb.cc:557:39: error: non-constant-expression cannot be narrowed from type 'Pixel_X' (aka 'short') to 'uint16_t' (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
  557 |                           point_size, point_size,            // diameters
      |                                       ^~~~~~~~~~
Plot_xcb.cc:557:39: note: insert an explicit cast to silence this issue
  557 |                           point_size, point_size,            // diameters
      |                                       ^~~~~~~~~~
      |                                       static_cast<uint16_t>( )
Plot_xcb.cc:565:33: error: non-constant-expression cannot be narrowed from type 'Pixel_X' (aka 'short') to 'uint16_t' (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
  565 |                                 point_size2, point_size2,            // dia
      |                                 ^~~~~~~~~~~
Plot_xcb.cc:565:33: note: insert an explicit cast to silence this issue
  565 |                                 point_size2, point_size2,            // dia
      |                                 ^~~~~~~~~~~
      |                                 static_cast<uint16_t>( )
Plot_xcb.cc:565:46: error: non-constant-expression cannot be narrowed from type 'Pixel_X' (aka 'short') to 'uint16_t' (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
  565 |                                 point_size2, point_size2,            // dia
      |                                              ^~~~~~~~~~~
Plot_xcb.cc:565:46: note: insert an explicit cast to silence this issue
  565 |                                 point_size2, point_size2,            // dia
      |                                              ^~~~~~~~~~~
      |                                              static_cast<uint16_t>( )
Plot_xcb.cc:692:30: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling-gsl]
  692 |          const char * lstr = l_props[l]->get_legend_name().c_str();
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Plot_xcb.cc:1103:37: error: non-constant-expression cannot be narrowed from type 'Pixel_X' (aka 'short') to 'uint16_t' (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
 1103 |      xcb_rectangle_t rect = { 0, 0, w_props.get_window_width(),
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
Plot_xcb.cc:1103:37: note: insert an explicit cast to silence this issue
 1103 |      xcb_rectangle_t rect = { 0, 0, w_props.get_window_width(),
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                     static_cast<uint16_t>(    )
Plot_xcb.cc:1104:37: error: non-constant-expression cannot be narrowed from type 'Pixel_Y' (aka 'short') to 'uint16_t' (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
 1104 |                                     w_props.get_window_height() };
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Plot_xcb.cc:1104:37: note: insert an explicit cast to silence this issue
 1104 |                                     w_props.get_window_height() };
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                     static_cast<uint16_t>(     )


This version of clang has evidently turned on -Werror=c++11-narrowing by default. A workaround is to add -Wno-c++11-narrowing to CXXFLAGS when configuring but perhaps the code could be changed so that this warning isn't tripped.

Ryan Carsten Schmidt <ryandesign>

 

Attached Files

This item currently has no attached files.

(Note: upload size limit is set to 4.0MiB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by ryandesign (Submitted the item)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-11ef.
    Corresponding source code