summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/class.derived
Commit message (Collapse)AuthorAgeFilesLines
* [Concepts] Deprecate -fconcepts-ts, enable Concepts under -std=c++2aSaar Raz2020-01-241-1/+1
| | | | | | | | | Now with concepts support merged and mostly complete, we do not need -fconcepts-ts (which was also misleading as we were not implementing the TS) and can enable concepts features under C++2a. A warning will be generated if users still attempt to use -fconcepts-ts. (cherry picked from commit 67c608a9695496cfc9d3fdf9d0b12b554ac6b4df)
* [Concepts] Function trailing requires clausesSaar Raz2020-01-091-0/+21
| | | | | | Function trailing requires clauses now parsed, supported in overload resolution and when calling, referencing and taking the address of functions or function templates. Differential Revision: https://reviews.llvm.org/D43357
* [cxx2a] P0641R2: (Some) type mismatches on defaulted functions onlyRichard Smith2018-09-281-2/+2
| | | | | | | | | | | | | | | | render the function deleted instead of rendering the program ill-formed. This change also adds an enabled-by-default warning for the case where an explicitly-defaulted special member function of a non-template class is implicitly deleted by the type checking rules. (This fires either due to this language change or due to pre-C++20 reasons for the member being implicitly deleted). I've tested this on a large codebase and found only bugs (where the program means something that's clearly different from what the programmer intended), so this is enabled by default, but we should revisit this if there are problems with this being enabled by default. llvm-svn: 343285
* Add context note to diagnostics that occur while declaring an implicit ↵Richard Smith2017-02-231-3/+5
| | | | | | special member function. llvm-svn: 296020
* Sema: add warning for c++ member variable shadowingSaleem Abdulrasool2017-02-083-11/+123
| | | | | | | | | | Add a warning for shadowed variables across records. Referencing a shadow'ed variable may not give the desired variable. Add an optional warning for the shadowing. Patch by James Sun! llvm-svn: 294401
* Move checks for creation of objects of abstract class type from the variousRichard Smith2016-12-152-0/+120
| | | | | | | | | constructs that can do so into the initialization code. This fixes a number of different cases in which we used to fail to check for abstract types. Thanks to Tim Shen for inspiring the weird code that uncovered this! llvm-svn: 289753
* When diagnosing that a defaulted function is ill-formed because it would beRichard Smith2016-10-311-5/+13
| | | | | | | implicitly deleted and overrides a non-deleted function, explain why the function is deleted. For PR30844. llvm-svn: 285610
* PR6037Nathan Sidwell2015-01-191-1/+1
| | | | | | Warn on inaccessible direct base llvm-svn: 226423
* Revert r218925 - "Patch to warn if 'override' is missing"Alexander Potapenko2014-10-031-4/+4
| | | | | | | | | | | | | | | | | | | | This CL has caused bootstrap failures on Linux and OSX buildbots running with -Werror. Example report from http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/13183/steps/bootstrap%20clang/logs/stdio: ================================================================ [ 91%] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/AMDGPUISelDAGToDAG.cpp:20: In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIISelLowering.h:19: /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIInstrInfo.h:71:8: error: 'getLdStBaseRegImmOfs' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] bool getLdStBaseRegImmOfs(MachineInstr *LdSt, ^ /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/include/llvm/Target/TargetInstrInfo.h:815:16: note: overridden virtual function is here virtual bool getLdStBaseRegImmOfs(MachineInstr *LdSt, ^ ================================================================ llvm-svn: 218969
* Patch to warn if 'override' is missingFariborz Jahanian2014-10-021-4/+4
| | | | | | | | | | | | for an overriding method if class has at least one 'override' specified on one of its methods. Reviewed by Doug Gregor. rdar://18295240 (I have already checked in all llvm files with missing 'override' methods and Bob Wilson has fixed a TableGen of FastISel so no warnings are expected from build of llvm after this patch. I have already verified this). llvm-svn: 218925
* Implement final resolution of DR1402: implicitly-declared move operators thatRichard Smith2013-11-041-2/+2
| | | | | | | | | | | would be deleted are still declared, but are ignored by overload resolution. Also, don't delete such members if a subobject has no corresponding move operation and a non-trivial copy. This causes us to implicitly declare move operations in more cases, but risks move-assigning virtual bases multiple times in some circumstances (a warning for that is to follow). llvm-svn: 193969
* Improve error for "override" + non-virtual func.Eli Friedman2013-09-051-0/+20
| | | | | | | | | | | | | | | | | | | Consider something like the following: struct X { virtual void foo(float x); }; struct Y : X { void foo(double x) override; }; The error is almost certainly that Y::foo() has the wrong signature, rather than incorrect usage of the override keyword. This patch adds an appropriate diagnostic for that case. Fixes <rdar://problem/14785106>. llvm-svn: 190109
* Tests and status for core issues 1-50.Richard Smith2013-05-191-0/+11
| | | | llvm-svn: 182207
* If a defaulted special member is implicitly deleted, check whether it'sRichard Smith2013-04-021-0/+26
| | | | | | | overriding a non-deleted virtual function. The existing check for this doesn't catch this case, because it fires before we mark the method as deleted. llvm-svn: 178563
* Fix CXXRecordDecl::forallBases to not look through bases which are dependentRichard Smith2012-11-221-0/+30
| | | | | | | | and defined within the current instantiation, but which are not part of the current instantiation. Previously, it would look at bases which could be specialized separately from the current template. llvm-svn: 168477
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-191-0/+1
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* Implement C++ 10.3p16 - overrides involving deleted functions must match.David Blaikie2012-10-171-0/+16
| | | | | | | Only deleted functions may override deleted functions and non-deleted functions may only override non-deleted functions. llvm-svn: 166082
* PR13499: Don't try to check whether 'override' has been validly applied untilRichard Smith2012-08-061-0/+49
| | | | | | | we know whether the function is virtual. But check it as soon as we do know; in some cases we don't need to wait for an instantiation. llvm-svn: 161316
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* Handle redundant 'typename' on base class specifications.David Blaikie2011-10-251-0/+3
| | | | llvm-svn: 142937
* Fix erroneous name-specifiers prior to decltypes better/correctly as per ↵David Blaikie2011-10-251-2/+2
| | | | | | Doug's feedback. llvm-svn: 142935
* Fix cases where the optional nested-name-specifier erroneously preceeded a ↵David Blaikie2011-10-251-0/+4
| | | | | | decltype-specification when specifying a base type. llvm-svn: 142928
* Support the use of decltype for specifying base types. Fixes PR11216.David Blaikie2011-10-251-0/+33
| | | | llvm-svn: 142926
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-131-1/+1
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Get rid of handling of the 'explicit' keyword from class-head. We still ↵Anders Carlsson2011-03-251-22/+0
| | | | | | parse it though, although that will change shortly. llvm-svn: 128277
* Fix PR8767, improve diagnostic wording when allocating an object of anChandler Carruth2011-02-182-7/+7
| | | | | | | | abstract class type. Patch by Stephen Hines, with a wording tweak from Doug applied by me. llvm-svn: 125996
* Implement [class.derived]p8.Anders Carlsson2011-01-221-0/+22
| | | | llvm-svn: 124047
* Diagnose when a virtual member function marked final is overridden.Anders Carlsson2011-01-201-0/+11
| | | | llvm-svn: 123916
* When instantiating member functions, propagate whether the member function ↵Anders Carlsson2011-01-201-0/+16
| | | | | | | | is marked 'final' and 'override'. Also, call CheckOverrideControl when instantiating member functions. llvm-svn: 123900
* When checking for functions marked override, ignore dependent contexts.Anders Carlsson2011-01-201-0/+16
| | | | llvm-svn: 123894
* Diagnose virtual member functions marked override but not overriding any ↵Anders Carlsson2011-01-201-0/+10
| | | | | | virtual member functions. llvm-svn: 123888
* In the presence of using declarations, we can find the same classDouglas Gregor2010-10-221-0/+28
| | | | | | | | members in class subobjects of different types. So long as the underlying declaration sets are the same, and the declaration sets involve non-instance members, this is not an ambiguity. llvm-svn: 117163
* Implement computation of the final overriders for each virtualDouglas Gregor2010-03-233-0/+140
| | | | | | | | | | | | | | | | | | | | function within a class hierarchy (C++ [class.virtual]p2). We use the final-overrider computation to determine when a particular class is ill-formed because it has multiple final overriders for a given virtual function (e.g., because two virtual functions override the same virtual function in the same virtual base class). Fixes PR5973. We also use the final-overrider computation to determine which virtual member functions are pure when determining whether a class is abstract or diagnosing the improper use of an abstract class. The prior approach to determining whether there were any pure virtual functions in a class didn't cope with virtual base class subobjects properly, and could not easily be fixed to deal with the oddities of subobject hiding. Fixes PR6631. llvm-svn: 99351
* Reinstate r97674 with a fix for the assertion that was firing in <list>Douglas Gregor2010-03-031-0/+63
| | | | llvm-svn: 97686
* Revert r97674; it's causing failuresDouglas Gregor2010-03-031-63/+0
| | | | llvm-svn: 97677
* Implement disambiguation of base class members via aDouglas Gregor2010-03-031-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | nested-name-specifier. For example, this allows member access in diamond-shaped hierarchies like: struct Base { void Foo(); int Member; }; struct D1 : public Base {}; struct D2 : public Base {}; struct Derived : public D1, public D2 { } void Test(Derived d) { d.Member = 17; // error: ambiguous cast from Derived to Base d.D1::Member = 17; // error: okay, modify D1's Base's Member } Fixes PR5820 and <rdar://problem/7535045>. Also, eliminate some redundancy between Sema::PerformObjectMemberConversion() and Sema::PerformObjectArgumentInitialization() -- the latter now calls the former. llvm-svn: 97674
* Implement name hiding for names found through virtual base subobjectsDouglas Gregor2010-03-031-0/+40
| | | | | | | | that are hidden by other derived base subobjects reached along a lookup path that does *not* pass through the hiding subobject (C++ [class.member.lookup]p6). Fixes PR6462. llvm-svn: 97640
* Fix for PR5840: fix the kind of name lookup used for classes inEli Friedman2009-12-211-0/+8
| | | | | | | | | | Sema::getTypeName. "LookupNestedNameSpecifierName" isn't quite the right kind of lookup, though; it doesn't ignore namespaces. Someone more familiar with the lookup code should fix this properly. llvm-svn: 91809
* 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
* When a member reference expression includes a qualifier on the memberDouglas Gregor2009-08-261-0/+19
name, e.g., x->Base::f() retain the qualifier (and its source range information) in a new subclass of MemberExpr called CXXQualifiedMemberExpr. Provide construction, transformation, profiling, printing, etc., for this new expression type. When a virtual function is called via a qualified name, don't emit a virtual call. Instead, call that function directly. Mike, could you add a CodeGen test for this, too? llvm-svn: 80167
OpenPOWER on IntegriCloud