diff options
| author | Douglas Gregor <dgregor@apple.com> | 2008-10-31 16:23:19 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2008-10-31 16:23:19 +0000 |
| commit | 26bee0b3262275f2fe680cb72e860682e32a0763 (patch) | |
| tree | 05899d26f3b7772c5d9b65aba22c72cf22723d4f /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | 71d7e9b6672e90659b7b6c7efd011d03abc7c975 (diff) | |
| download | bcm5719-llvm-26bee0b3262275f2fe680cb72e860682e32a0763.tar.gz bcm5719-llvm-26bee0b3262275f2fe680cb72e860682e32a0763.zip | |
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)
llvm-svn: 58513
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index cd722729412..6a25dd5bc3e 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -575,6 +575,24 @@ void Sema::ActOnFinishCXXClassDef(DeclTy *D) { /// @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; } |

