Index: test/tools/llvm-rc/Inputs/tag-dialog.rc =================================================================== --- test/tools/llvm-rc/Inputs/tag-dialog.rc +++ test/tools/llvm-rc/Inputs/tag-dialog.rc @@ -35,7 +35,7 @@ ArgsOld DIALOG 1, 2, 3, 4 { LTEXT "L", 1, 2, 3, 4, 5 LTEXT "L2", 6, 7, 8, 9, 10, 11 - LTEXT "L3", 12, 13, 14, 15, 16, 17, 18 + LTEXT "L3", -1, 13, 14, 15, 16, 17, 18 EDITTEXT 19, 20, 21, 22, 23 EDITTEXT 24, 25, 26, 27, 28, 29 Index: test/tools/llvm-rc/tag-dialog.test =================================================================== --- test/tools/llvm-rc/tag-dialog.test +++ test/tools/llvm-rc/tag-dialog.test @@ -122,7 +122,7 @@ ; DIALOG-NEXT: 0030: 00000000 0B000250 00000000 07000800 |.......P........| ; DIALOG-NEXT: 0040: 09000A00 0600FFFF 82004C00 32000000 |..........L.2...| ; DIALOG-NEXT: 0050: 00000000 11000250 12000000 0D000E00 |.......P........| -; DIALOG-NEXT: 0060: 0F001000 0C00FFFF 82004C00 33000000 |..........L.3...| +; DIALOG-NEXT: 0060: 0F001000 FFFFFFFF 82004C00 33000000 |..........L.3...| ; DIALOG-NEXT: 0070: 00000000 00008150 00000000 14001500 |.......P........| ; DIALOG-NEXT: 0080: 16001700 1300FFFF 81000000 00000000 |................| ; DIALOG-NEXT: 0090: 1D008150 00000000 19001A00 1B001C00 |...P............| Index: tools/llvm-rc/ResourceFileWriter.cpp =================================================================== --- tools/llvm-rc/ResourceFileWriter.cpp +++ tools/llvm-rc/ResourceFileWriter.cpp @@ -981,8 +981,11 @@ // ID; it's 16-bit in DIALOG and 32-bit in DIALOGEX. if (!IsExtended) { - RETURN_IF_ERROR(checkNumberFits( - Ctl.ID, "Control ID in simple DIALOG resource")); + // It's common to use -1, i.e. UINT32_MAX, for controls one doesn't + // want to refer to later. + if (Ctl.ID != std::numeric_limits::max()) + RETURN_IF_ERROR(checkNumberFits( + Ctl.ID, "Control ID in simple DIALOG resource")); writeInt(Ctl.ID); } else { writeInt(Ctl.ID);