summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/constructor-template.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Lit Test] Updated 34 Lit tests to be C++11 compatible.Charles Li2015-11-171-1/+7
| | | | | | | Added expected diagnostics new to C++11. Expanded RUN line to: default, C++98/03 and C++11. llvm-svn: 253371
* If a non-template constructor instantiated to X(X),John McCall2014-12-141-1/+49
| | | | | | | | | | | | | | | | | | | | | | | ignore it during overload resolution when initializing X from a value of type cv X. Previously, our rule here only ignored specializations of constructor templates. That's probably because the standard says that constructors are outright ill-formed if their first parameter is literally X and they're callable with one argument. However, Clang only enforces that prohibition against non-implicit instantiations; I'm not sure why, but it seems to be deliberate. Given that, the most sensible thing to do is to just ignore the "illegal" constructor regardless of where it came from. Also, stop ignoring such constructors silently: print a note explaining why they're being ignored. Fixes <rdar://19199836>. llvm-svn: 224205
* Improve our handling of C++ [class.copy]p3, which specifies that aDouglas Gregor2010-11-081-3/+20
| | | | | | | | | constructor template will not be used to copy a class object to a value of its own type. We were eliminating all constructor templates whose specializations look like a copy constructor, which eliminated important candidates. Fixes PR8182. llvm-svn: 118418
* Improve our handling of user-defined conversions as part of overloadDouglas Gregor2010-04-171-0/+15
| | | | | | | | | | | | | | | | | resolution. There are two sources of problems involving user-defined conversions that this change eliminates, along with providing simpler interfaces for checking implicit conversions: - It eliminates a case of infinite recursion found in Boost. - It eliminates the search for the constructor needed to copy a temporary generated by an implicit conversion from overload resolution. Overload resolution assumes that, if it gets a value of the parameter's class type (or a derived class thereof), there is a way to copy if... even if there isn't. We now model this properly. llvm-svn: 101680
* Improve the diagnostics used to report implicitly-generated class membersJohn McCall2010-01-061-4/+4
| | | | | | | | | as parts of overload sets. Also, refer to constructors as 'constructors' rather than functions. Adjust a lot of tests. llvm-svn: 92832
* Switch the initialization required by return statements over to theDouglas Gregor2009-12-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | new InitializationSequence. This fixes some bugs (e.g., PR5808), changed some diagnostics, and caused more churn than expected. What's new: - InitializationSequence now has a "C conversion sequence" category and step kind, which falls back to - Changed the diagnostics for returns to always have the result type of the function first and the type of the expression second. CheckSingleAssignmentConstraints to peform checking in C. - Improved ASTs for initialization of return values. The ASTs now capture all of the temporaries we need to create, but intentionally do not bind the tempoary that is actually returned, so that it won't get destroyed twice. - Make sure to perform an (elidable!) copy of the class object that is returned from a class. - Fix copy elision in CodeGen to properly see through the subexpressions that occur with elidable copies. - Give "new" its own entity kind; as with return values and thrown objects, we don't bind the expression so we don't call a destructor for it. Note that, with this patch, I've broken returning move-only types in C++0x. We'll fix it later, when we tackle NRVO. llvm-svn: 91669
* Introduce a centralized routine in Sema for diagnosing failed lookups (whenJohn McCall2009-12-161-3/+3
| | | | | | | | | used as expressions). In dependent contexts, try to recover by doing a lookup in previously-dependent base classes. We get better diagnostics out, but unfortunately the recovery fails: we need to turn it into a method call expression, not a bare call expression. Thus this is still a WIP. llvm-svn: 91525
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Improve template instantiation for object constructions in several ways:Douglas Gregor2009-12-141-0/+12
| | | | | | | | | | | | | - During instantiation, drop default arguments from constructor and call expressions; they'll be recomputed anyway, and we don't want to instantiate them twice. - Rewrote the instantiation of variable initializers to cope with non-dependent forms properly. Together, these fix a handful of problems I introduced with the switch to always rebuild expressions from the source code "as written." llvm-svn: 91315
* Improve on diagnosing type mismatches because of Fariborz Jahanian2009-11-181-4/+4
| | | | | | lack of viable convesion functions. llvm-svn: 89216
* If we attempt to add a constructor template specialization that looksDouglas Gregor2009-11-141-1/+31
| | | | | | | | | | | | like a copy constructor to the overload set, just ignore it. This ensures that we don't try to use such a constructor as a copy constructor *without* triggering diagnostics at the point of declaration. Note that we *do* diagnose such copy constructors when explicitly written by the user (e.g., as an explicit specialization). llvm-svn: 88733
* Revert r88718, which does NOT solve the ↵Douglas Gregor2009-11-131-19/+1
| | | | | | constructor-template-as-copy-constructor issue. Big thanks to John for finding this llvm-svn: 88724
* A constructor template cannot be instantiated to a copyDouglas Gregor2009-11-131-1/+19
| | | | | | constructor. Make sure that such declarations can never be formed. llvm-svn: 88718
* Introduce a new class, UnqualifiedId, that provides a parsedDouglas Gregor2009-11-031-0/+1
| | | | | | | | | | | | | | | | representation of a C++ unqualified-id, along with a single parsing function (Parser::ParseUnqualifiedId) that will parse all of the various forms of unqualified-id in C++. Replace the representation of the declarator name in Declarator with the new UnqualifiedId class, simplifying declarator-id parsing considerably and providing more source-location information to Sema. In the future, I hope to migrate all of the other unqualified-id-parsing code over to this single representation, then begin to merge actions that are currently only different because we didn't have a unqualified notion of the name in the parser. llvm-svn: 85851
* Commit test case from PR4655, which tests the canonical-types fix in r81913Douglas Gregor2009-09-151-0/+5
| | | | llvm-svn: 81916
* Add an assertion and a test case, in a fruitless attempt to track down an ↵Douglas Gregor2009-09-151-0/+20
| | | | | | existing bug llvm-svn: 81885
* Make sure to adjust function template declarations to their templatedDouglas Gregor2009-08-241-0/+4
| | | | | | | declarations (e.g., FunctionTemplateDecl -> CXXConstructorDecl) before performing semantic analysis on the declarations. Fixes PR4761. llvm-svn: 79911
* Introduce support for constructor templates, which can now be declaredDouglas Gregor2009-08-211-0/+24
and will participate in overload resolution. Unify the instantiation of CXXMethodDecls and CXXConstructorDecls, which had already gotten out-of-sync. llvm-svn: 79658
OpenPOWER on IntegriCloud