Re: GCC vs. CL
От: Kaa Украина http://blog.meta.ua/users/kaa/
Дата: 08.11.02 20:09
Оценка:
Здравствуйте ssi, Вы писали:

>Если у ab убрать конструкор и написать

ssi>   foo<ab, 2> theFoo = { 1, 2, 1, 2 };

ssi>все компилируется.

Вот что написано по сему вопросу в стандарте (8.5.1):

An aggregate is an array or a class (clause 9) with no user-declared constructors (12.1), no private or protected nonstatic data members (clause 11), no base classes (clause 10), and no virtual functions (10.3).
...
When an aggregate is initialized the initializer can be an initializer-clause
consisting of a braceenclosed, comma-separated list of initializers for the members of the aggregate, written in increasing subscript or member order. If the aggregate contains subaggregates, this rule applies recursively to the members of the subaggregate.


Таким образом, мы видим, что ab не является агрегатом, и соответственно, все правильно. Ну а когда убираем конструктор, то все становится на свои места, и такая запись проходит.
Алексей Кирдин
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.