anlamını değiştirir:Beyanı aşağıdaki kodu için sembol
struct foo {};
struct A
{
typedef foo foo_type;
void foo();
};
GCC bir derleyici hata veriyor:
test.cpp:7:14: error: declaration of 'void A::foo()' [-fpermissive]
void foo();
^
test.cpp:1:8: error: changes meaning of 'foo' from 'struct foo' [-fpermissive]
struct foo {};
^
Ama clang derleyici hataları olmadan kabul eder. Kim haklı? typedef typedef ::foo foo_type
kaldırıldı veya değiştirilirse, gcc, clang hem kod kabul etmesini
Not.
Asıl soru şu: * Neden * Clang her zaman haklıdır? –
yazım hatası olmadığında o zaman garip değil – 4pie0
@ cf16: Ben öyle demedim. Ben sadece, yazım hatası söz değil, hataya rağmen, typedef hata ile ilgili bir şey var, işaret etmek istedim. – HighCommander4