Skip to content

[Bug]: gcc 15.2 typename in depedent scope problem #3149

Description

@kSkip

What Operating System(s) are you seeing this problem on?

Linux (x86-64)

dlib version

a41c2e6

Python version

N/A

Compiler

GCC 15.2

Expected Behavior

no compilation failures

Current Behavior

compilation of dlib fails with the following error

image_processing/scan_image_pyramid_tools.h:85:1: error: need ‘typename’ before ‘std::__cxx11::list<std::pair<__decay(long unsigned int&), __decay(const dlib::rectangle)> >::iterator’ because ‘std::__cxx11::list<std::pair<__decay(long unsigned int&), __decay(const dlib::rectangle)> >’ is a dependent scope [-Wtemplate-body]
   85 |                 list_type::iterator i = sorted_rects.begin();

Steps to Reproduce

checkout master branch at a41c2e6 and compile with GCC 15.2

Anything else?

I recently moved to Ubuntu 26.04 which uses GCC 15.2 as the default C++ compiler. This error appeared when compiling a fresh cmake config of a project that depends on dlib. I prefer to use the default GCC version for my Linux distro, so this is a problem.

Honestly, I think it may be a bug in GCC because the type it is complaining about is list_type::iterator where list_type is defined as typedef std::list<std::pair<unsigned long, rectangle> > list_type;. This is not a dependent type because it does not refer to any template parameters.

If I replace list_type::iterator with auto, it compiles fine. I can make a PR for this, but it seems like a dumb workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions