Skip to content

Runtime exception instead of compile time error when formatting a user type. #201

Closed
@ScottLangham

Description

@ScottLangham

I tried to format a CAtlString (from header atlstr).
I'm using Visual Studio 2013 update 5.

With the following code, I expected that if cppformat isn't aware of CAtlString, I'd get a compile-time error and have to provide an override or template specialization to explain to cppformat what to do. But, I get a run time exception instead.

        ATL::CAtlString s("hi");
        auto formattedString = fmt::sprintf("Hello %s", s);
        auto result = std::string("Hello hi");
        Assert::AreEqual(result, formattedString);

Am I doing something wrong? This feels a bit error prone as it would be easy to code this by mistake.

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