diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-29 22:16:16 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-29 22:16:16 +0000 |
commit | 0c74e8a4e8865ec9ebb8efc0af247a3c077236c4 (patch) | |
tree | bcfbfd9c201c4ab859f040b2093b8b07203845a7 /lib/Sema/SemaOverload.cpp | |
parent | d302f90a942cc15fea805e540a7c8ee2ca0fe6a7 (diff) |
Implement semantic analysis for transparent unions. This is largely
based on a patch from Anders Johnsen. CodeGen support is incomplete,
in that we do not properly coerce to the first field's type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70419 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index f4b6598d9e..ab66939656 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1888,9 +1888,13 @@ bool Sema::PerformCopyInitialization(Expr *&From, QualType ToType, if (!getLangOptions().CPlusPlus) { // In C, argument passing is the same as performing an assignment. QualType FromType = From->getType(); + AssignConvertType ConvTy = CheckSingleAssignmentConstraints(ToType, From); - + if (ConvTy != Compatible && + CheckTransparentUnionArgumentConstraints(ToType, From) == Compatible) + ConvTy = Compatible; + return DiagnoseAssignmentResult(ConvTy, From->getLocStart(), ToType, FromType, From, Flavor); } |