constexpr NSString generating crashing code when used with vararg parameters

Originator:peter
Number:rdar://28562009 Date Originated:30-Sep-2016 05:11 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 8
Classification:Bad Compiled Code Reproducible:Always
 
Summary:
This code with constexpr crashes with bad access exception.

/// Crashes
	constexpr NSString* quitName = @"Whatever";
/ Works
//	static NSString* quitName = @"Whatever";

	NSLog( @"This %@", quitName );

Steps to Reproduce:
Run the code.  Project attached.  Crash results.

Crash is likely caused because quitName, while used in NSLog, is used as a vararg and ARC is not seeing that use as a requirement to keep the variable alive.

Expected Results:
Working would be nice

Actual Results:
Crashes with bad access exception (in non-optimised compiles).

Version:
Version 8.0 (8A218a)

Notes:


Configuration:
Sierra 10.12.0

Attachments:
'ConstExprARCIssue.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!