Skip to content

Incorrect constraint check for call to module-imported function template with deduced return type #453

Open

Description

@daveedvdv-nvidia

Discussed in #242

Originally posted by cpplearner October 8, 2026

Issue Summary

When a call to an uninstantiated function template with deduced return type appears in a requires-expression, and the function template is imported from a (MSVC-generated) IFC file, EDG evaluates the constraint to false, even though a direct call to the function template works fine.

Like #230, this bug affects the uses of IntelliSense with import std; because MSVC STL's std::ranges::begin has an operator() with a deduced return type, and std::ranges::range calls std::ranges::begin in its requires-expression.

Reproducing Source Code

mod1.ixx (compiled with MSVC's cl.exe /c /std:c++20 mod1.ixx):

export module mod1;

export template<class T>
auto fn(T&&)
{
    return 42;
}

example.cxx (compiled with \CXX\edgcpp-compiler\build\msvc-release\bin\cpfe.exe --ms_c++20 --modules example.cxx):

import mod1;

template<class T>
concept range = requires(T& t) {
    fn(t);
};

static_assert(range<int(&)[1]>); // static assertion failed, should be OK

int main() {}

Command-line Options

cpfe.exe --ms_c++20 --modules example.cxx

Type of Issue

[Front End] This code SHOULD compile with these options.

Additional Details

The IFC file is generated by MSVC Compiler Version 19.52.36815 for x64 (PREVIEW). The file example.cxx compiles fine with cl.exe /std:c++20 example.cxx and fails to compile with cl.exe /BE /std:c++20 example.cxx.

This is the generated IFC file (zipped):
mod1.ifc.zip

Reproducing (Standard) Configuration(s)

windows-msvc-release

Reproducing (Non-standard) Configuration

No response

I acknowledge that:

  • I have checked open issues and existing discussions before filing this report.
  • The reproducing source code that I have provided does not depend on headers that I have not included with my submission.
  • I have reduced the reproducing source code to the best of my ability.
  • I have selected at least one standard configuration or uploaded a non-standard configuration dump.
  • I understand code shared via this form is NOT confidential.
  • I have permission to share the reproducing source code and grant permission for the project to use the source code (or derivatives of the source code) to create tests.
  • I agree that any tests created using the reproducing source code (or deriatives of it) will be licensed under project license unless I included a LICENSE.txt file in my .zip or .tar.gz upload. If I included a LICENSE.txt file, any tests created using the reproducing source code will be governed by the terms of the license I provided instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions