diff --git a/conans/client/graph/compatibility.py b/conans/client/graph/compatibility.py index a23669c8870..7805878c2cd 100644 --- a/conans/client/graph/compatibility.py +++ b/conans/client/graph/compatibility.py @@ -65,10 +65,10 @@ def cppstd_compat(conanfile): new_combinations = [] for comb in combinations: for f in factor: - comb = comb.copy() - comb.update(f) - new_combinations.append(comb) - combinations = new_combinations + new_comb = comb.copy() + new_comb.update(f) + new_combinations.append(new_comb) + combinations.extend(new_combinations) ret = [] for comb in combinations: diff --git a/test/integration/package_id/compatible_test.py b/test/integration/package_id/compatible_test.py index dca4e3c063a..a931701fc54 100644 --- a/test/integration/package_id/compatible_test.py +++ b/test/integration/package_id/compatible_test.py @@ -400,3 +400,21 @@ def package_id(self): c.run("install --requires=pdfium/2020.9 -pr=myprofile -s build_type=Debug") assert "missing. Using compatible package" in c.out + + def test_compatibility_msvc_and_cppstd(self): + """msvc 194 would not find compatible packages built with same version but different cppstd + due to an issue in the msvc fallback compatibility rule.""" + tc = TestClient() + profile = textwrap.dedent(""" + [settings] + compiler=msvc + compiler.version=194 + compiler.runtime=dynamic + """) + tc.save({"dep/conanfile.py": GenConanfile("dep", "1.0").with_setting("compiler"), + "conanfile.py": GenConanfile("app", "1.0").with_require("dep/1.0").with_setting("compiler"), + "profile": profile}) + + tc.run("create dep -pr=profile -s compiler.cppstd=20") + tc.run("create . -pr=profile -s compiler.cppstd=17") + tc.assert_listed_binary({"dep/1.0": ("b6d26a6bc439b25b434113982791edf9cab4d004", "Cache")})