Аноним:
А>Знатоки стандарта, подскажите, пожалуйста, допустима ли следующая конструкция:
А>А>struct Base
А>{
А> typedef int SomeType;
А>};
А>struct Derived : Base
А>{
А> typedef SomeType BaseSomeType; // подразумевается Base::SomeType, т.к. ещё не успели переопределить
А> typedef double SomeType;
А>};
А>
Так делать нельзя.
C++03 — 3.3.6/1:
2) A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. No diagnostic is required for a violation of this rule.
3) If reordering member declarations in a class yields an alternate valid program under (1) and (2), the program is ill-formed, no diagnostic is required.
А>MSVC нормально компилирует, CodePad тоже. Comeau Online ругается, но сообщение об ошибке выдаёт странное. Кто прав?
Все правы, т.к. диагностика нарушения правил в данном случае не требуется.