Skip to content

w32_regex_traits: BASETYPES does not imply LCTYPE (and other symbols) #250

@boimart1

Description

@boimart1

When specific Windows headers are selectively included before boost/regex is included, w32_regex_traits.hpp incorrectly assumes LCTYPE and various other symbols are defined.

This appears to be due to the check for BASETYPES:

This macro is defined in minwindef.h, But LCTYPE is actually defined in winnls.h. This check only holds if minwindef.h is transitively included through windows.h, which will itself include winnls.h.

As such, the following minimum example code fails to compile with the following error:

#define _AMD64_  // assuming x64
#include <windef.h>
#include <boost/regex.hpp>
C:\.conan\3072f8\1\include\boost-1_86\boost\regex\v5\w32_regex_traits.hpp(200): error C2061: syntax error: identifier 'LCTYPE'
// various other errors for unknown identifiers

In my project, this problem appeared after updating CLI11 from 2.1.2 to 2.4.2. In header-only mode, the new version includes only a few Windows headers in its implementation (link).

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