-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Xcode] Compile failure with ARC enabled in program with an Objective-C++ test runner. #1661
Comments
Same bug with Xcode 10.2.1 and Catch 2.9.1 Adding 'virtual' to the NSString* overrides seems to be the fix (and it should be present no matter what). However I tried this and am now getting the following:
This repeats for each override method. So it appears the override signature is different from the base signature. This is probably due to the const qualifier which has caused problems before with Catch and Objc. Variants of this issue keep cropping up. See #1571 and #278. |
In Catch 2.4, MatcherBase had a template override for pointers. This override contained a match signature without 'const'. I suspect whenever this was removed was when the NSString* code broke:
|
Here's a patch against 2.9.1 single-header that seems to fix the problem. Our internal tests now build and pass. I don't know Catch2 well enough to get a test case, but I'll see if I can figure it out. It would be nice to have this bug stop cropping up by getting some basic ObjC++ tests.
|
My standing thoughts on Objective-C++ is that I don't use it and I am not planning to learn it either, but if someone is willing to set up CI, I am willing to avoid breaking it. |
Thanks to bdb for the patch, related to #1661
@bdb Should be fixed in master, can you test it? (You will need to regenerate the single header with |
Will do @horenmar. I'll try to find some time to work on a basic test case too. |
Hi Brian @bdb , Today, I have learned kung-fu. Thank you. If only I had the where-with-all to ask that question or come to such reasoning when tracing this elusive and rather horrendous compiler bug. You are a champion for hunting this down and going back to Catch 2.4.. Good onya mate! One thing about one of your prior comments about the missing
In C++11 onwards, the I saw that this fix is in Catch2 v2.9.2, so I will pull that down and run our test suite against it. This is awesome stuff! Hi Martin @horenmar , Now, I'm not sure if a basic smoke screen test like the one I provided as a test case for this issue would serve as a nice basis for a simple, "can we still compile test case". Given Brian's digging back to v2.4, it might a nice addition to a regression test suite. Thanking you both for nailing this issue, and I can't wait to try out the new release! |
Describe the bug
Programs containing Catch2's single_include header fail to compile in Xcode projects that:
Objective-C Automatic Reference Counting
set toYes
; and,.mm
file.The following compile time errors are experienced:
These errors are resolved when the Build Setting,
Objective-C Automatic Reference Counting
is set toNO
.Expected behavior
To be able to compile the program.
Reproduction steps
Steps to reproduce the bug.
For iOS
File->New->Project
. Make sure language selected is Objective-C.Objective-C Automatic Reference Counting
is set toYes
.Header Search Paths
.main.m
tomain.mm
AppDelegate.*
andViewController.*
files.main.mm
with:For macOS
Follow steps 1-7 from For iOS, substituting 2 with:
2. Select 'Cocoa App' from the macOS templates.
Platform information:
Additional context
I have attached a sample project that exhibits this behavior. The sample can be found in the attachment: catch2arc_compilation_error.zip.
This sample is packaged with Catch version v2.9.1.
After uncompressing the file, open the pre-built Xcode project:
catch2arc_compilation_error.xcodeproj
In the project, there are two schemes:
The targets for each scheme are:
The Build Setting
Objective-C Automatic Reference Counting
for targets is set to:Compile the scheme
catch2arc_compilation_error
to see the errors.The text was updated successfully, but these errors were encountered: