compiler crash: optional chaining on ~Copyable type #75999
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
crash
Bug: A crash, i.e., an abnormal termination of software
expressions
Feature: expressions
noncopyable struct/enum
Feature → declarations: Noncopyable value type declarations
type checker
Area → compiler: Semantic analysis
Description
I tried to use optional chaining on an
Optional<NonCopyable>
, wherestruct NonCopyable: ~Copyable
. The compiler crashed.Reproduction
Put this in
nc.swift
:Then compile it:
Stack dump
Expected behavior
I expected the compiler to not crash. Not sure what else there is to say…
Environment
I used the “main” Swift development snapshot of 2024-08-20: swift-DEVELOPMENT-SNAPSHOT-2024-08-19-a.xctoolchain
It also crashes with the toolchains of Xcode 16.0 beta 4 and Xcode 16.1 beta 1, but does not crash with the toolchain of Xcode-16.0 beta 3.
Additional information
Changing the
?
to!
makes the compiler not crash.The text was updated successfully, but these errors were encountered: