Lines Matching defs:C
1 //===------ SemaDeclCXX.cpp - Semantic Analysis for C++ Declarations ------===//
9 // This file implements semantic analysis for C++ declarations.
69 /// CheckDefaultArgumentVisitor - C++ [dcl.fct.default] Traverses
109 // C++ [dcl.fct.default]p9:
113 // C++17 [dcl.fct.default]p9 (by CWG 2082):
122 // C++ [dcl.fct.default]p7:
126 // C++17 [dcl.fct.default]p7 (by CWG 2082):
130 // C++20 [dcl.fct.default]p7 (DR as part of P0588R1, see also CWG 2346):
142 /// VisitCXXThisExpr - Visit a C++ "this" expression.
144 // C++ [dcl.fct.default]p8:
260 // C++0x [except.spec]p14:
289 // C++ [dcl.fct.default]p5
338 // Default arguments are only permitted in C++
349 // C++11 [dcl.fct.default]p3
405 // C++ [dcl.fct.default]p3
498 // C++ [dcl.fct.default]p4:
511 // C++ [dcl.fct.default]p6:
599 // C++ [temp.expr.spec]p21:
613 // C++ [dcl.fct.default]p6 (DR217):
658 // C++11 [dcl.constexpr]p1: If any declaration of a function or function
674 // C++11 [dcl.fcn.spec]p4:
682 // C++17 [temp.deduct.guide]p3:
692 // C++11 [dcl.fct.default]p4: If a friend declaration specifies a default
703 // C++11 [temp.friend]p4 (DR329):
757 // C++17 [dcl.dcl]/8:
760 // C++20 [dcl.dcl]/8:
763 // C++23 [dcl.pre]/6:
821 // C++2a [dcl.struct.bind]p1:
1351 /// perform anywhere else in C++.
1537 // C++1z [dcl.decomp]/2:
1557 // C++1z [dcl.decomp]/3:
1575 // C++1z [dcl.dcl]/8:
1585 // C++1z [dcl.decomp]/4:
1630 /// function declaration are well-formed according to C++
1652 // C++20 [dcl.fct.default]p4:
1700 "this check is obsolete for C++23");
1733 "this check is obsolete for C++23");
1756 "this check is obsolete for C++23");
1790 // C++11 [dcl.constexpr]p4:
1813 // C++11 [dcl.constexpr]p3:
1816 // - it shall not be virtual; (removed in C++20)
1841 // - its return type shall be a literal type; (removed in C++23)
1850 // have constexpr destructors. (removed in C++23)
1860 // - each of its parameter types shall be a literal type; (removed in C++23)
1872 /// body. C++11 [dcl.constexpr]p3,p4, and C++1y [dcl.constexpr]p3.
1879 // C++11 [dcl.constexpr]p3 and p4:
1917 // C++1y allows types to be defined, not just declared.
1935 // C++11 and permitted in C++1y, so ignore them.
1940 // C++1y [dcl.constexpr]p3 allows anything except:
1942 // thread storage duration or [before C++2a] for which no
1998 // These are disallowed in C++11 and permitted in C++1y. Allow them
2035 // In C++20 onwards, there's nothing to check for validity.
2109 // C++1y allows return statements in constexpr constructors.
2126 // C++1y allows compound-statements.
2140 // C++1y allows if-statements.
2160 // C++1y allows all of these. We don't allow them as extensions in C++11,
2178 // C++1y allows switch-statements, and since they don't need variable
2179 // mutation, we can reasonably allow them in C++11 as an extension.
2204 // C++2a allows inline assembly statements.
2229 // C++1y allows expression-statements.
2243 /// the permitted types of statement. C++11 [dcl.constexpr]p3,p4.
2253 // C++11 [dcl.constexpr]p3:
2259 // C++11 [dcl.constexpr]p4:
2263 // This restriction is lifted in C++2a, as long as inner statements also
2391 // The formal requirements don't include this rule in C++14, even
2419 // C++11 [dcl.constexpr]p5:
2423 // C++11 [dcl.constexpr]p3:
2426 // C++11 [dcl.constexpr]p4:
2433 // disabled, the function is declared in a system header, or we're in C++23
2461 // since C++23 no longer mandates constexpr functions to yield constant
2466 // C++14 doesn't require constexpr functions to contain a 'return'
2590 assert(getLangOpts().CPlusPlus && "No class names in C!");
2610 assert(getLangOpts().CPlusPlus && "No class names in C!");
2652 // C++ [class.derived.general]p2:
2657 // C++ [class.union.general]p4:
2711 // C++ [class]p3:
2767 // We do not support any C++11 attributes on base-specifiers yet.
2788 // C++ [class.union.general]p4:
2855 // C++ [class.mi]p3:
3127 // C++ class member Handling
3198 // C++11 [class.virtual]p5:
3386 // C++ 9.2p6: A member shall not be declared to have automatic storage
3388 // C++ 7.1.1p8: The mutable specifier can be applied only to names of class
3518 // C++ 9.6p3: A bit-field shall not be a static member.
3528 // C++ 9.6p3: A bit-field shall have integral or enumeration type.
3551 // C++ [temp.deduct.guide]p3:
4109 // C++11 [class.base.init]p7:
4201 // Callback to only accept typo corrections that can be a valid C++ member
4305 // not a C++ constructor. Ignore the error for now, because we may
4313 // C++ [class.base.init]p2:
4525 // C++11 [class.base.init]p7:
4589 // C++11 [class.base.init]p7:
4629 // C++ [class.base.init]p2:
4671 // C++ [base.class.init]p2:
4699 // C++ [base.class.init]p2:
4728 // C++11 [class.base.init]p7:
4915 // C++11 [class.copy]p15:
5010 // Default-initialize Objective-C pointers to NULL.
5104 for (auto *C : Indirect->chain()) {
5105 FieldDecl *Field = dyn_cast<FieldDecl>(C);
5141 // C++11 [class.base.init]p8:
5260 for (auto *C : F->chain()) {
5261 FieldDecl *FD = dyn_cast<FieldDecl>(C);
5341 // C++ [class.bit]p2:
5913 // C++ [class.abstract]p4:
6696 /// registers, per C++ [class.temporary]p3.
6702 // Clang <= 4 used the pre-C++11 rule, which ignores move operations.
6713 // is passed according to the C ABI. Otherwise, it is passed indirectly.
6755 // multiple x64 calling conventions and the C++ ABI code shouldn't dictate
6769 // Per C++ [class.temporary]p3, the relevant condition is:
6867 // C++ [class.mem]p13:
6872 // C++ [class.mem]p14:
7137 // whether this class uses any C++ features that are implemented
7144 // support "ms_struct except for C++ stuff" as a secondary ABI.
7148 // to build C++ code, unless this diagnostic is turned off.
7352 // C++11 [dcl.constexpr]p4:
7376 // In C++1y, we need to perform overload resolution.
7404 // C++1y [class.copy]p26:
7515 // Set the calling convention to the default for C++ instance methods.
7573 // C++11 [dcl.fct.def.default]p1:
7580 // C++2a changes the second bullet to instead delete the function if it's
7646 // [C++23][dcl.fct.def.default]/p2.2
7647 // if F2 has an implicit object parameter of type “reference to C”,
7649 // parameter is of (possibly different) type “reference to C”,
7715 // C++11 [dcl.fct.def.default]p2:
7720 // functions which cannot be constexpr (for non-constructors in C++11 and for
7721 // destructors in C++14 and C++17), this is checked elsewhere.
7727 // C++14 [dcl.constexpr]p6 (CWG DR647/CWG DR1358):
7757 // C++2a [dcl.fct.def.default]p3:
7767 // C++2a [except.spec]p3:
7801 // C++11 [dcl.fct.def.default]p4:
7874 /// C++2a [class.compare.default].
7879 // C++2a [class.compare.default]p4:
7880 // The direct base class subobjects of C
7887 // followed by the non-static data members of C
7889 // C++23 [class.bit]p2:
7961 /// specified in C++2a [class.compare.default]p4.
7997 // C++2a [class.compare.default]p2 [P2002R0]:
7998 // A defaulted comparison operator function for class C is defined as
7999 // deleted if [...] C has variant members.
8025 // C++2a [class.compare.default]p2 [P2002R0]:
8026 // A defaulted <=> or == operator function for class C is defined as
8027 // deleted if any non-static data member of C is of reference type
8059 /// C++2a [class.compare.default]p1 [P2002R0]:
8077 // C++2a [class.compare.secondary]p2 [P2002R0]:
8104 // Throughout C++2a [class.compare]: if overload resolution does not
8130 // C++2a [class.compare.default]p3 [P2002R0]:
8331 // C++2a [class.eq]p3:
8382 // Per C++2a [class.spaceship]p3, as a fallback add:
8587 // Per C++2a [class.eq]p2, each comparison is individually contextually
8595 // Per C++2a [class.spaceship]p3, form:
8647 // C++2a [class.compare.secondary]p2:
8710 // C++2a [class.compare.default]p1:
8711 // A defaulted comparison operator function for some class C shall be a
8712 // non-template function declared in the member-specification of C that is
8713 // -- a non-static const non-volatile member of C having one parameter of
8714 // type const C& and either no ref-qualifier or the ref-qualifier &, or
8715 // -- a friend of C having two parameters of type const C& or two
8716 // parameters of type C.
8872 // C++2a [class.eq]p1, [class.rel]p1:
8883 // C++2a [class.spaceship]p2 [P2002R0]:
8911 // C++11 [dcl.fct.def.default]p4:
8925 // C++20 [class.compare.default]p1:
8953 // C++2a [class.spaceship]p2:
8970 // C++2a [dcl.fct.def.default]p3 [P2002R0]:
8973 // C++2a [class.compare.default]p3 [P2002R0]:
8979 // We support P2448R2 in language modes earlier than C++23 as an extension.
8981 // C++23 [dcl.fct.def.default]p3 [P2448R2]
8984 // C++23 [dcl.constexpr]p3
9002 // C++2a [dcl.fct.def.default]p3 [P2002R0]:
9010 // C++2a [except.spec]p3:
9394 // C++11 [class.ctor]p5:
9400 // C++11 [class.copy]p11, C++11 [class.copy]p23:
9405 // C++11 [class.dtor]p5:
9414 // C++11 [class.ctor]p5, C++11 [class.copy]p11:
9500 // C++11 [class.ctor]p5 (modified by DR2394): any non-variant non-static
9532 // C++11 [class.copy]p23:
9588 /// C++11 [class.ctor] p5:
9612 /// deleted, as specified in C++11 [class.ctor]p5, C++11 [class.copy]p11,
9613 /// C++11 [class.copy]p23, and C++11 [class.dtor]p5.
9626 // C++11 [expr.lambda.prim]p19:
9630 // C++2a adds back these operators if the lambda has no lambda-capture.
9646 // C++11 [class.copy]p7, p18:
9701 // C++11 [class.dtor]p5:
9790 // C++11 [class.ctor]p5:
9819 // C++11 [class.dtor]p5:
9836 // C++11 [class.copy]p12:
9849 // In C++98, we are not supposed to perform overload resolution here, but we
9857 // C++11 [class.copy]p25:
9867 // In C++98, we are not supposed to perform overload resolution here, but we
10004 // C++11 [class.ctor]p5:
10016 // Objective C ARC 4.3.5:
10056 // C++11 [class.copy]p12, p25: [DR1593]
10128 // C++11 [class.ctor]p5, C++11 [class.dtor]p5:
10133 // C++11 [class.copy]p12, C++11 [class.copy]p25:
10142 // C++11 [class.ctor]p5, C++11 [class.dtor]p5:
10149 // C++11 [class.copy]p12, C++11 [class.copy]p25:
10157 // C++11 [class.dtor]p5:
10166 // C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25:
10220 /// Member lookup function that determines whether a given C++
10466 /// in a given class definition, per C++2a [class.compare.default]p3.
10582 // C++2a [class.compare.default]p3:
10692 /// C++ method declaration. We're (re-)introducing the given
10752 // C++ [class.ctor]p3:
10784 // C++0x [class.ctor]p4:
10814 // C++ [class.copy]p3:
10862 // C++ [class.dtor]p13:
10891 // C++ [class.dtor]p1:
10906 // C++ [class.dtor]p2:
10949 // C++0x [class.dtor]p2:
11007 // C++ [class.conv.fct]p1:
11053 // [C++2b]
11149 // C++ [class.conv.fct]p4:
11169 // C++0x explicit conversion operators.
11185 // C++ [class.conv.fct]p1:
11381 // C++ [temp.deduct.guide]p3:
11542 // C++ [namespace.std]p7:
11556 // C++ [namespace.def]p2:
11650 // C++ [namespace.unnamed]p1. An unnamed-namespace-definition
11760 "Looking for comparison category type outside of C++.");
11881 "Looking for std::initializer_list outside of C++.");
11997 // C++ [dcl.init.list]p2:
12143 // C++ [namespace.udir]p1:
12217 // C++11 inheriting constructors.
12352 // We don't need to do this in C++11 because we do the check once on
12358 // template <class T> struct C : A {};
12359 // template <class T> struct D : C<T> { using B::foo; } // <---
12360 // This is invalid (during instantiation) in C++03 because B::foo
12362 // We can't diagnose it immediately because C<T> is an unknown
12420 // C++ [class.mem]p19:
12933 // C++14 [namespace.udecl]p6:
13068 // C++03 [namespace.udecl]p8:
13069 // C++0x [namespace.udecl]p10:
13145 // C++ 20 permits using an enumerator that does not have a class-hierarchy
13158 // C++14 [namespace.udecl]p7:
13160 // C++20 p1099 permits enumerators.
13174 // C++03 [namespace.udecl]p3:
13175 // C++0x [namespace.udecl]p8:
13177 // C++20 [namespace.udecl]p7
13223 // Don't provide a fixit outside C++11 mode; we don't want to suggest
13236 // Don't provide a fixit outside C++11 mode; we don't want to suggest
13258 // FIXME: in C++0x, we can diagnose if we can prove that the
13288 // C++11 [namespace.udecl]p3:
13321 // C++03 [namespace.udecl]p4:
13473 // FIXME: The C++0x standard does not clearly say this is ill-formed,
13703 // C++ [except.spec]p14:
13718 // C++1z [except.spec]p7:
13721 // C++1z [except.spec]p8:
13731 // struct C : B { void f(); };
13828 // C++ [class.ctor]p5:
14117 // C++ [class.dtor]p2:
14245 // If the context is an invalid C++ class, just suppress these checks.
14293 // C++11 [class.dtor]p3:
14312 // change in behavior can break conforming C++03 programs at runtime.
14536 // C++11 [class.copy]p28:
14545 // C++03 [class.copy]p13:
14559 // Prior to C++11, filter out any result that isn't a copy/move-assignment
14575 // Suppress the protected check (C++ [class.protected]) for each of the
14906 // C++11 [class.copy]p18:
14913 // C++0x [class.copy]p30:
15281 // C++0x [class.copy]p28:
15342 // C++11 [class.copy]p28:
15493 // C++ [class.copy]p4:
15617 // C++11 [class.copy]p7:
15670 // C++11 [class.copy]p11:
15924 // C++0x [class.copy]p34:
16205 // C++ [basic.stc.dynamic.allocation]p1:
16215 // C++ [basic.stc.dynamic.allocation]p1:
16224 // C++ [basic.stc.dynamic.allocation]p1:
16236 // C++ [basic.stc.dynamic.deallocation]p1:
16245 // C++ P0722:
16246 // Within a class C, the first parameter of a destroying operator delete
16247 // shall be of type C *. The first parameter of any other deallocation
16255 // C++ [basic.stc.dynamic.deallocation]p2:
16263 // C++ P0722:
16282 // C++ [over.oper]p5:
16294 // C++ [over.oper]p7:
16299 // Note: Before C++23, a member function could not be static. The only member
16330 // C++ [over.oper]p8:
16334 // Only the function-call operator (C++ [over.call]p1) and the subscript
16371 // C++ [over.oper]p8:
16421 // C++ [over.inc]p1:
16460 // C++20 [over.literal]p5:
16526 // C++20 also allows template <SomeClass T> type operator "" name().
16657 // C++23 [usrlit.suffix]p1:
16660 // contain a double underscore __ are reserved for use by C++
16678 if (Lang == "C")
16679 Language = LinkageSpecLanguageIDs::C;
16680 else if (Lang == "C++")
16694 /// C++ [module.unit]p7.2.3
16758 // C++ 15.3p1: The exception-declaration shall not denote an incomplete type.
16805 // Only the non-fragile NeXT runtime currently supports C++ catches
16836 // C++ [except.handle]p16:
17305 // In C mode, allow folding as an extension for better compatibility with
17306 // C++ in terms of expressions like static_assert("test") or
17511 // C++ [class.friend]p3:
17550 // C++23 [dcl.pre]p5:
17579 // C++98 [class.friend]p1: A friend of a class is a function
17581 // This is fixed in DR77, which just barely didn't make the C++03
17617 // C++ [class.friend]p1
17635 // C++ [namespace.memdef]p3
17677 // C++11 [class.friend]p11:
17710 // C++11 [namespace.memdef]p3:
17760 // C++ [class.friend]p1: A friend of a class is a function or
17858 // C++ [class.friend]p6:
17890 // C++11 [dcl.fct.default]p4: If a friend declaration specifies a
17962 // C++11 [basic.start.main]p3:
17967 // C++11 [dcl.fct.def.delete]p4:
18245 // C++14 [class.virtual]p8:
18339 /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
18390 // C++ 6.4p2:
18577 // no key function or the key function is inlined. Don't warn in C++ ABIs
18615 // C++ [basic.def.odr]p2:
18681 CXXConstructorDecl *C = Target;
18682 while (C->getCanonicalDecl() != Canonical) {
18684 (void)C->getTargetConstructor()->hasBody(FNTarget);
18687 C = const_cast<CXXConstructorDecl*>(
18689 S.Diag(C->getLocation(), diag::note_which_delegates_to);
18740 // C++11 [expr.prim.general]p3:
18942 /// HandleMSProperty - Analyze a __delcspec(property) field of a C++ class.
19050 // C++23 [dcl.fct]p23: