aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-29 22:16:16 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-29 22:16:16 +0000
commit0c74e8a4e8865ec9ebb8efc0af247a3c077236c4 (patch)
treebcfbfd9c201c4ab859f040b2093b8b07203845a7 /lib/Sema/SemaOverload.cpp
parentd302f90a942cc15fea805e540a7c8ee2ca0fe6a7 (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.cpp6
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);
}