Skip to content

Default recursive template instantiations is lower than recommended #18791

@llvmbot

Description

@llvmbot
Bugzilla Link 18417
Version trunk
OS Linux
Attachments Patch to increase -ftemplate-depth default value to 1024
Reporter LLVM Bugzilla Contributor
CC @zygoloid

Extended Description

N3690 annex B states:

  • Recursively nested template instantiations, including substitution during template argument deduction (14.8.2) [1024].

Though this is not a compliance issue, IMO, it would be nice if clang could do -ftemplate-depth=1024 by default, which is the case with gcc (gcc-4.8 at least).

$ man gcc
[snipped...]
       -ftemplate-depth=n
           Set the maximum instantiation depth for template classes to n.  A limit on the template instantiation depth
           is needed to detect endless recursions during template class instantiation.  ANSI/ISO C++ conforming
           programs must not rely on a maximum depth greater than 17 (changed to 1024 in C++0x).
[snipped...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++14clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions