Implement basic support for converting constructors in user-defined
conversions.
Notes:
- Overload resolution for converting constructors need to prohibit
user-defined conversions (hence, the test isn't -verify safe yet).
- We still use hacks for conversions from a class type to itself.
This will be the case until we start implicitly declaring the appropriate
special member functions. (That's next on my list)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58513 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index cd72272..6a25dd5 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -575,6 +575,24 @@
/// @endcode
Sema::DeclTy *Sema::ActOnConstructorDeclarator(CXXConstructorDecl *ConDecl) {
assert(ConDecl && "Expected to receive a constructor declaration");
+
+ // Check default arguments on the constructor
+ CheckCXXDefaultArguments(ConDecl);
+
+ // FIXME: Make sure this constructor is an overload of the existing
+ // constructors and update the class to reflect the addition of this
+ // constructor (e.g., it now has a user-defined constructor, might
+ // have a user-declared copy constructor, etc.).
+
+ // Add this constructor to the set of constructors of the current
+ // class.
+ if (CXXRecordDecl *ClassDecl = dyn_cast_or_null<CXXRecordDecl>(CurContext)) {
+ ClassDecl->addConstructor(ConDecl);
+ } else {
+ assert(false && "Cannot add a constructor if we're not in the class!");
+ }
+
+
return (DeclTy *)ConDecl;
}