https://llvm.org/bugs/show_bug.cgi?id=29094
Bug ID: 29094 Summary: C++11 attributes not accepted in template explicit instantiation Product: clang Version: 3.8 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: C++11 Assignee: unassignedclangb...@nondot.org Reporter: matthew.woeh...@kitware.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified Clang rejects the following code, with the error "an attribute list cannot appear here": template <typename T> T foo(T) { return 0; } template [[gnu::visibility("default")]] int foo<int>(int); Live example: https://gcc.godbolt.org/#compilers:!((compiler:clang380,options:'-std%3Dc%2B%2B11',source:'template+%3Ctypename+T%3E%0AT+foo(T)+%7B+return+0%3B+%7D%0A%0Atemplate+%5B%5Bgnu::visibility(%22default%22)%5D%5D%0Aint+foo%3Cint%3E(int)%3B%0A')),filterAsm:(commentOnly:!t,directives:!t,labels:!t),version:3 GCC accepts this code. As I read N4606 [A.6] and [A.12], this should be accepted as: <explicit-instantiation> --> [extern] template <declaration> --> [extern] template <nodeclspec-function-declaration> --> [extern] template [<attribute-specifier-seq>] <declarator> ; Moreover, there doesn't seem to be any manner in which Clang accepts an attribute on an explicit instantiation, which seems surely not intended. Also, the old style attribute, `__attribute__((visibility("default")))`, is accepted. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs