Skip to content

VS2026 Insiders, C2678 With C++23 Modules #5002

@ToddThomson

Description

@ToddThomson

Description

When using the Module build of nlohmann::json I get the following error:
binary '!=': no operator found which takes a left-hand operand of type 'nullptr' (or there is no acceptable conversion)
This occurs at line 20512 of the current dev branch of json.hpp.

module;
#include <cstdint>
#include <string>
//#include <sstream> // TJT: Note: Without this include, VS2026 will not complile the toJson() 

export module Dnn.Modules.Softmax:Config;

import Dnn.ModuleConfig;
import nlohmann.json;

namespace Mila::Dnn
{
    using json = nlohmann::json;
// Later

json toJson() const
{
    json j;
    j["name"] = name_;
    //j["precision"] = static_cast<int>( precision_ );
    //j["axis"] = axis_;

    return j;
}`

With the included (Another similar module had this include and compiled fine AND tested fine ) there is no compilation error.

I'll look into this more but I am busy for the rest of the day

Reproduction steps

not having the include
#include <sstream>
triggers the compilation error c2678

Expected vs. actual results

The include essentially is providing a needed dependency that is missing in the json.hpp module based code.

Minimal code example

Error messages

Compiler and operating system

Win 11, VS2026

Library version

Dev branch, Module build

Validation

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions