Repository: conan-io/conan

Issue:
[question] Error with _check_correct_cppstd: compiler.cppstd=20 on QNX with custom settings.yml
### What is your question?

I'm getting this error with Conan 2.17.1:

```
ERROR: Error while processing 'profile.py' plugin, line 13
        _check_correct_cppstd(settings)
while calling '_check_correct_cppstd', line 29
        raise ConanException(f"The provided compiler.cppstd={cppstd} is not supported by {compiler} {version}. "
        ConanException: The provided compiler.cppstd=20 is not supported by qcc 12.2. Supported values are: ['98', 'gnu98', '11', 'gnu11', '14', 'gnu14', '17', 'gnu17']
```
QCC on QNX 8 is 12.2 and it supports C++20 standard.

My settings.yml is:

```
compiler:
    qcc:
        version: ["12.2"]
        cppstd: [null, 98, 03, 11, 14, 17, 20]
```

### Have you read the CONTRIBUTING guide?

- [x] I've read the CONTRIBUTING guide


Discussion:
Hi @tkielan 

Thanks for your feedback.

The issue is that the profile plugin is not using the settings definition, its purpose is to validate that a given compiler version supports a given cppstd. So it is implemented internally in functions such as:
```python
def _clang_supported_cppstd(version):
    """
    ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23"]
    """
    if version < "2.1":
        return []
    if version < "3.4":
        return ["98", "gnu98", "11", "gnu11"]
    if version < "3.5":
        return ["98", "gnu98", "11", "gnu11", "14", "gnu14"]
    if version < "6":
        return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
    if version < "12":
        return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]
    # https://github.com/conan-io/conan/pull/17092
    if version < "17.0":
        return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20",
                "23", "gnu23"]
    return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23",
            "26", "gnu26"]

def _qcc_supported_cppstd(version):
    """
    [98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17]
    """

    if version < "5":
        return ["98", "gnu98"]
    else:
        return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
```

As you can see, it means that the ``_qcc_supported_cppstd`` internal implementation needs an update.

Can you please confirm from which exact ``qcc`` version it supports ``C++20``? It is 12.2 the first one or it is earlier.
Please let us know, so we can update that definition, I think it can be fixed for next Conan 2.18 soon.

In the meantime, the easiest workaround for you to move forward is to disable the ``profile.py`` plugin, you can leave it empty, or avoid the checks for ``qcc``, see docs in https://docs.conan.io/2/reference/extensions/profile_plugin.html
Hi,

What I have found is that QNX QCC feature set is equivalent to same version
of GCC.
- QNX 7.0 have QCC 5.4.0 with full C++14 support
- QNX 7.1 have QCC 8.3.0 with full C++17 support
- QNX 8.0 have QCC 12.2 with full C++20 support

It is hard to find this in QNX documentation. BlackBerry prefers running
the compiler which will say what standard does it support.
Unfortunately, I do not have valid license for older versions of QNX to
verify that.

You could try to double check the data for correctness and partial support
with GCC support state.

Thank you, Tim

On Wed, Jun 25, 2025 at 2:46 PM James ***@***.***> wrote:

> *memsharded* left a comment (conan-io/conan#18532)
> <https://github.com/conan-io/conan/issues/18532#issuecomment-3004645708>
>
> Hi @tkielan <https://github.com/tkielan>
>
> Thanks for your feedback.
>
> The issue is that the profile plugin is not using the settings definition,
> its purpose is to validate that a given compiler version supports a given
> cppstd. So it is implemented internally in functions such as:
>
> def _clang_supported_cppstd(version):
>     """    ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23"]    """
>     if version < "2.1":
>         return []
>     if version < "3.4":
>         return ["98", "gnu98", "11", "gnu11"]
>     if version < "3.5":
>         return ["98", "gnu98", "11", "gnu11", "14", "gnu14"]
>     if version < "6":
>         return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
>     if version < "12":
>         return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]
>     # https://github.com/conan-io/conan/pull/17092
>     if version < "17.0":
>         return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20",
>                 "23", "gnu23"]
>     return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23",
>             "26", "gnu26"]
> def _qcc_supported_cppstd(version):
>     """    [98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17]    """
>
>     if version < "5":
>         return ["98", "gnu98"]
>     else:
>         return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
>
> As you can see, it means that the _qcc_supported_cppstd internal
> implementation needs an update.
>
> Can you please confirm from which exact qcc version it supports C++20? It
> is 12.2 the first one or it is earlier.
> Please let us know, so we can update that definition, I think it can be
> fixed for next Conan 2.18 soon.
>
> In the meantime, the easiest workaround for you to move forward is to
> disable the profile.py plugin, you can leave it empty, or avoid the
> checks for qcc, see docs in
> https://docs.conan.io/2/reference/extensions/profile_plugin.html
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/conan-io/conan/issues/18532#issuecomment-3004645708>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ACAJQJLHROVGGBJDJKATFND3FKK3JAVCNFSM6AAAAACADFKWHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAMBUGY2DKNZQHA>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>


-- 
Tim Kielan
Registered Linux User #239184

vim [noun] - lively or energetic spirit; enthusiasm; vitality

Excellent, thanks for your feedback, it helps.

Doing https://github.com/conan-io/conan/pull/18538 PR for next Conan 2.18.



Patch:
diff --git a/conan/tools/build/cppstd.py b/conan/tools/build/cppstd.py
index b7c18227623..5832c214fc7 100644
--- a/conan/tools/build/cppstd.py
+++ b/conan/tools/build/cppstd.py
@@ -266,8 +266,11 @@ def _qcc_supported_cppstd(version):
 
     if version < "5":
         return ["98", "gnu98"]
-    else:
+    elif version < "12":
         return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
+    else:
+        return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]
+
 
 def _emcc_supported_cppstd(version):
     """


Test patch:
diff --git a/test/unittests/tools/build/test_cppstd.py b/test/unittests/tools/build/test_cppstd.py
index 1997c72bbde..e3c418af9f9 100644
--- a/test/unittests/tools/build/test_cppstd.py
+++ b/test/unittests/tools/build/test_cppstd.py
@@ -128,6 +128,7 @@ def test_supported_cppstd_mcst(compiler, compiler_version, values):
     ("qcc", "4.4", ['98', 'gnu98']),
     ("qcc", "5.4", ['98', 'gnu98', '11', 'gnu11', "14", "gnu14", "17", "gnu17"]),
     ("qcc", "8.3", ['98', 'gnu98', '11', 'gnu11', "14", "gnu14", "17", "gnu17"]),
+    ("qcc", "12.2", ['98', 'gnu98', '11', 'gnu11', "14", "gnu14", "17", "gnu17", "20", "gnu20"]),
 ])
 def test_supported_cppstd_qcc(compiler, compiler_version, values):
     settings = MockSettings({"compiler": compiler, "compiler.version": compiler_version})