Repository: conan-io/conan

Issue:
[bug] XCode 16.3 apple-clang 17 support is missing
### Describe the bug

MacOSX 15.3.2, XCode 16.3, Conan 2.15.0

[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=17
os=Macos

### How to reproduce it

1. Update XCode to the newest 16.3
2. Start conan install . --build
3. An error received:

ERROR: Invalid setting '17' is not a valid 'settings.compiler.version' value.
Possible values are ['5.0', '5.1', '6.0', '6.1', '7.0', '7.3', '8.0', '8.1', '9.0', '9.1', '10.0', '11.0', '12.0', '13', '13.0', '13.1', '14', '14.0', '15', '15.0', '16', '16.0']


Discussion:
Hi @Syndwar thanks a lot for taking the time to open the issue.

I've now opened https://github.com/conan-io/conan/pull/18051 to add the new released versions to the `settings.yml` file, but note that it might take a few weeks for the next release.

In the meantime, you can use the `settings_user.yml` file to add the extra fields in an extensible way, see https://docs.conan.io/2/examples/config_files/settings/settings_user.html#examples-config-files-settings-user for an example usage if you need support now, thanks!





Patch:
diff --git a/conan/internal/api/detect/detect_api.py b/conan/internal/api/detect/detect_api.py
index b429db3080f..07b6e2d4385 100644
--- a/conan/internal/api/detect/detect_api.py
+++ b/conan/internal/api/detect/detect_api.py
@@ -325,9 +325,12 @@ def _intel_cppstd_default(version):
         # https://www.intel.com/content/www/us/en/developer/articles/troubleshooting/icx-changes-default-cpp-std-to-cpp17-with-2023.html
         return "17" if major >= "2023" else "14"
 
+    def _apple_clang_cppstd_default(version):
+        return "gnu98" if version < "17" else "gnu14"
+
     default = {"gcc": _gcc_cppstd_default(compiler_version),
                "clang": _clang_cppstd_default(compiler_version),
-               "apple-clang": "gnu98",
+               "apple-clang": _apple_clang_cppstd_default(compiler_version),
                "intel-cc": _intel_cppstd_default(compiler_version),
                "msvc": _visual_cppstd_default(compiler_version),
                "mcst-lcc": _mcst_lcc_cppstd_default(compiler_version)}.get(str(compiler), None)
@@ -338,7 +341,7 @@ def detect_cppstd(compiler, compiler_version):
     cppstd = default_cppstd(compiler, compiler_version)
     if compiler == "apple-clang" and compiler_version >= "11":
         # Conan does not detect the default cppstd for apple-clang,
-        # because it's still 98 for the compiler (eben though xcode uses newer in projects)
+        # because it's still 98/14 for the compiler (even though xcode uses newer in projects)
         # and having it be so old would be annoying for users
         cppstd = "gnu17"
     return cppstd
diff --git a/conan/internal/default_settings.py b/conan/internal/default_settings.py
index 3f19ec83115..51b2b5d552c 100644
--- a/conan/internal/default_settings.py
+++ b/conan/internal/default_settings.py
@@ -23,24 +23,25 @@
                     "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "15.7", "15.8",
                     "16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6", "16.7",
                     "17.0", "17.1", "17.2", "17.3", "17.4", "17.5", "17.6", "17.8",
-                    "18.0", "18.1"]
+                    "18.0", "18.1", "18.2", "18.3", "18.4"]
         sdk: ["iphoneos", "iphonesimulator"]
         sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
                         "13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7",
                         "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4",
                         "15.5", "16.0", "16.1", "16.2", "16.4", "17.0", "17.1", "17.2", "17.4", "17.5",
-                        "18.0", "18.1"]
+                        "18.0", "18.1", "18.2", "18.3", "18.4"]
     watchOS:
         version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2", "6.3",
                     "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6",
                     "8.0", "8.1", "8.3", "8.4", "8.5", "8.6", "8.7",
                     "9.0","9.1", "9.2", "9.3", "9.4", "9.5", "9.6",
                     "10.0", "10.1", "10.2", "10.3", "10.4", "10.5", "10.6",
-                    "11.0", "11.1"]
+                    "11.0", "11.1", "11.2", "11.3", "11.4"]
         sdk: ["watchos", "watchsimulator"]
         sdk_version: [null, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
                         "7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5", "9.0", "9.1",
-                        "9.4", "10.0", "10.1", "10.2", "10.4", "10.5", "11.0", "11.1"]
+                        "9.4", "10.0", "10.1", "10.2", "10.4", "10.5",
+                        "11.0", "11.1", "11.2", "11.3", "11.4"]
     tvOS:
         version: ["11.0", "11.1", "11.2", "11.3", "11.4",
                     "12.0", "12.1", "12.2", "12.3", "12.4",
@@ -49,26 +50,26 @@
                     "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6",
                     "16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6",
                     "17.0", "17.1", "17.2", "17.3", "17.4", "17.5", "17.6",
-                    "18.0", "18.1"]
+                    "18.0", "18.1", "18.2", "18.3", "18.4"]
         sdk: ["appletvos", "appletvsimulator"]
         sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
                         "13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0",
                         "15.2", "15.4", "16.0", "16.1", "16.4", "17.0", "17.1", "17.2", "17.4", "17.5",
-                        "18.0", "18.1"]
+                        "18.0", "18.1", "18.2", "18.3", "18.4"]
     visionOS:
-        version: ["1.0", "1.1", "1.2", "2.0", "2.1"]
+        version: ["1.0", "1.1", "1.2", "2.0", "2.1", "2.2", "2.3", "2.4"]
         sdk: ["xros", "xrsimulator"]
-        sdk_version: [null, "1.0", "1.1", "1.2", "2.0", "2.1"]
+        sdk_version: [null, "1.0", "1.1", "1.2", "2.0", "2.1", "2.2", "2.3", "2.4"]
     Macos:
         version: [null, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15",
                     "11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "11.6", "11.7",
                     "12.0", "12.1", "12.2", "12.3", "12.4", "12.5", "12.6", "12.7",
                     "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
                     "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7",
-                    "15.0", "15.1"]
+                    "15.0", "15.1", "15.2", "15.3", "15.4"]
         sdk_version: [null, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1",
                         "12.3", "13.0", "13.1", "13.3", "14.0", "14.2", "14.4", "14.5",
-                        "15.0", "15.1"]
+                        "15.0", "15.1", "15.2", "15.3", "15.4"]
         subsystem:
             null:
             catalyst:
@@ -138,7 +139,8 @@
         cstd: [null, 99, gnu99, 11, gnu11, 17, gnu17, 23, gnu23]
     apple-clang:
         version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1",
-                  "10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0", "15", "15.0", "16", "16.0"]
+                  "10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0", "15", "15.0",
+                  "16", "16.0", "17", "17.0"]
         libcxx: [libstdc++, libc++]
         cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23, 26, gnu26]
         cstd: [null, 99, gnu99, 11, gnu11, 17, gnu17, 23, gnu23]


Test patch:
diff --git a/test/unittests/client/build/cpp_std_flags_test.py b/test/unittests/client/build/cpp_std_flags_test.py
index dcf1e1fa3fe..f4f54c6d537 100644
--- a/test/unittests/client/build/cpp_std_flags_test.py
+++ b/test/unittests/client/build/cpp_std_flags_test.py
@@ -247,6 +247,15 @@ def test_apple_clang_cppstd_flags(self):
         self.assertEqual(_make_cppstd_flag("apple-clang", "16.0", "26"), "-std=c++26")
         self.assertEqual(_make_cppstd_flag("apple-clang", "16.0", "gnu26"), "-std=gnu++26")
 
+        self.assertEqual(_make_cppstd_flag("apple-clang", "17.0", "17"), "-std=c++17")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "17.0", "gnu17"), "-std=gnu++17")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "17.0", "20"), "-std=c++20")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "17.0", "gnu20"), "-std=gnu++20")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "17.0", "23"), "-std=c++23")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "17.0", "gnu23"), "-std=gnu++23")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "17.0", "26"), "-std=c++26")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "17.0", "gnu26"), "-std=gnu++26")
+
     def test_apple_clang_cppstd_defaults(self):
         self.assertEqual(_make_cppstd_default("apple-clang", "2"), "gnu98")
         self.assertEqual(_make_cppstd_default("apple-clang", "3"), "gnu98")
@@ -262,6 +271,8 @@ def test_apple_clang_cppstd_defaults(self):
         self.assertEqual(_make_cppstd_default("apple-clang", "13"), "gnu98")
         self.assertEqual(_make_cppstd_default("apple-clang", "14"), "gnu98")
         self.assertEqual(_make_cppstd_default("apple-clang", "15"), "gnu98")
+        self.assertEqual(_make_cppstd_default("apple-clang", "16"), "gnu98")
+        self.assertEqual(_make_cppstd_default("apple-clang", "17"), "gnu14")
 
     def test_visual_cppstd_flags(self):
         self.assertEqual(_make_cppstd_flag("msvc", "170", "11"), None)