Class Name Injection and Constructors

后端 未结 1 964
伪装坚强ぢ
伪装坚强ぢ 2021-01-11 10:44

Recently, upon updating a library to Clang 5.x, I noticed a bug in my code that had compiled previously on Clang 4.x, GCC 5.x-6.x, and MSVC 2015 and 2017.

#i         


        
相关标签:
1条回答
  • 2021-01-11 11:30

    Clang-5 is very much correct. Over at [class.qual]/2:

    In a lookup in which function names are not ignored and the nested-name-specifier nominates a class C:

    • if the name specified after the nested-name-specifier, when looked up in C, is the injected-class-name of C
    • ...

    the name is instead considered to name the constructor of class C.

    As for the other part of the question. Yes, it's definitely worth it to submit bug reports. Standard compliance (or at least more diagnostics towards it) are to be encouraged IMO.

    0 讨论(0)
提交回复
热议问题