diff options
| author | Nate Begeman <natebegeman@mac.com> | 2008-04-04 01:30:25 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2008-04-04 01:30:25 +0000 |
| commit | 002e4bd158d3142681847670c9d4f0754f166767 (patch) | |
| tree | 7196cca03d73426944e7c4ff4d0c226fe32c7072 /clang/lib/Sema/SemaExpr.cpp | |
| parent | 14bee50e06386e1a405914191cfe2ef4b88ad96e (diff) | |
| download | bcm5719-llvm-002e4bd158d3142681847670c9d4f0754f166767.tar.gz bcm5719-llvm-002e4bd158d3142681847670c9d4f0754f166767.zip | |
Ignore qualifiers when checking vector operands, just like scalar operands.
This prevents things like
a += b[0]; where a is a float4 and b is a float4 * (address_space 1)
llvm-svn: 49199
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index d4a97c1f8c9..1c6044a744a 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1286,10 +1286,13 @@ QualType Sema::InvalidOperands(SourceLocation loc, Expr *&lex, Expr *&rex) { inline QualType Sema::CheckVectorOperands(SourceLocation loc, Expr *&lex, Expr *&rex) { - QualType lhsType = lex->getType(), rhsType = rex->getType(); + // For conversion purposes, we ignore any qualifiers. + // For example, "const float" and "float" are equivalent. + QualType lhsType = lex->getType().getCanonicalType().getUnqualifiedType(); + QualType rhsType = rex->getType().getCanonicalType().getUnqualifiedType(); // make sure the vector types are identical. - if (lhsType.getCanonicalType() == rhsType.getCanonicalType()) + if (lhsType == rhsType) return lhsType; // if the lhs is an ocu vector and the rhs is a scalar of the same type, |

