Код: Выделить всё
#include
#include
#include
namespace foo {
template
using size_t = int;
}
using namespace foo;
struct Foo {
Foo() : a{} {}
std::array a;
};
int main() {}
Код: Выделить всё
predefined C++ types (compiler internal)(421): error C2872: 'size_t': ambiguous symbol
: note: could be 'unsigned __int64 size_t'
(7): note: or 'foo::size_t = int'
predefined C++ types (compiler internal)(421): note: the template instantiation context (the oldest one first) is
(13): note: see reference to function template instantiation 'void __builtin_array_init_helper(_T *,size_t) noexcept' being compiled
with
[
_Ty=std::optional,
_T=std::optional
]
Compiler returned: 2
Кроме того, учитывая случай MSVC with /permissive-, каждое из следующих изменений приводит к компиляции кода:
- удаление слоя std::array из,
- удаление слоя std::optional слоя из,
- удаление заданного вручную ctor по умолчанию,
- удаление только списка инициализаторов из ctor по умолчанию,
удаление директивы using namespace foo;.
Подробнее здесь: https://stackoverflow.com/questions/790 ... permissive