URL: https://linuxfr.org/forums/programmation-c/posts/probleme-de-parsing-avec-clang Title: problème de parsing avec CLang Authors: errno Date: 2013年04月29日T09:38:07+02:00 License: CC By-SA Tags: debian Score: 3 Salut à tous, J'essaie de compiler un gros projet (qui compile sous g++ et MSVC avec plein de warning activés et -Werr) avec CLang. Mais mon projet ne compile pas, j'ai reproduit le problème de compilation avec le petit code suivant: $ cat clang.cpp ```c++ #include template class Foo { private: PTR1 _t1; PTR2 _t2; public: Foo(PTR1 t1 = NULL, PTR2 t2 = NULL) : _t1(t1), _t2(t2) {} }; // aucun probleme pour clang void test(int a, const Foo & myset = Foo()) { std::cout << "a=" << a << std::endl; } class Bar { public: // probleme pour clang avec la meme definition mais dans une classe void test(int a, const Foo & myset = Foo()) { std::cout << "a=" << a << std::endl; } }; int main() { test(5); Bar bar; bar.test(4); return 0; } ``` $ clang++ -o test clang.cpp ``` clang.cpp:23:63: error: expected ')' void test(int a, const Foo & myset = Foo()) ^ clang.cpp:23:11: note: to match this '(' void test(int a, const Foo & myset = Foo()) ^ clang.cpp:23:58: error: expected '>' void test(int a, const Foo & myset = Foo()) ^ clang.cpp:33:12: error: too few arguments to function call, expected 3, have 1 bar.test(4); ~~~~~~~~ ^ clang.cpp:23:2: note: 'test' declared here void test(int a, const Foo & myset = Foo()) ^ 3 errors generated. ``` La signature de la fonction Bar::test est la même que test mais il semblerait que l'analyse syntaxique n'y arrive pas dans le cas d'une méthode de classe. S'agit-t-il d'un bug de clang ? $ clang++ -v Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0) Target: x86_64-pc-linux-gnu Thread model: posix Même problème avec la version de debian testing. Merci de vos réponses errno

AltStyle によって変換されたページ (->オリジナル) /