http://llvm.org/bugs/show_bug.cgi?id=15730
Bug ID: 15730
Summary: __attribute__((vector)) and templates
Product: clang
Version: 3.2
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Hi,
the following bit of code:
template <int N, typename T> struct Foo
{
typedef T __attribute__((vector_size(N*sizeof(T)))) type;
};
compiles fine with gcc 4.7.2, however when compiled with clang 3.2 I get:
foo.cc:4:41: error: expected ')'
typedef T __attribute__((vector_size(N*sizeof(T)))) type;
^
)
foo.cc:4:41: error: expected ')'
typedef T __attribute__((vector_size(N*sizeof(T)))) type;
^
)
foo.cc:4:53: error: expected member name or ';' after declaration specifiers
typedef T __attribute__((vector_size(N*sizeof(T)))) type;
~~~~~~~~~ ^
Moreover even doing:
template <int N, typename T> struct Foo
{
typedef T __attribute__((vector_size(16))) type;
};
does not work and gives:
foo.cc:4:28: error: invalid vector element type 'T'
typedef T __attribute__((vector_size(16))) type;
^
The only way to get it to work is to eliminate the dependency on the T template
argument:
template <int N, typename T> struct Foo
{
typedef int __attribute__((vector_size(16))) type;
};
compiles fine on both clang 3.2 and gcc 4.7.2
Any idea?
Ciao,
Giulio
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs