summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx98-compat.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PR43775: don't produce a bogus 'auto' -Wc++98-compat warning for CTADRichard Smith2019-10-271-0/+17
|
* Add missing -Wc++11-compat / -Wc++14-compat warnings for:Richard Smith2018-08-301-1/+2
| | | | | | | | * generic lambdas * return type deduction * class template argument deduction llvm-svn: 341098
* [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` ↵Eric Fiselier2018-05-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | messages. Summary: There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now! This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted. The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example: ``` def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">; ``` when used as ``` "candidate `%sub{select_ovl_candidate}3,2,1 not viable" ``` will act as if we wrote: ``` "candidate %select{function|constructor}3%select{| template| %1}2 not viable" ``` Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46740 llvm-svn: 332799
* Don't produce a redundant "auto type is incompatible with C++98" on every ↵Richard Smith2018-05-151-0/+2
| | | | | | | | lambda with no explicit return type. We already warned about the lambda, and we don't have a source location for the imagined "auto" anyway. llvm-svn: 332401
* Implement C++ DR727, which permits explicit specializations at class scope.Richard Smith2018-03-161-2/+2
| | | | | | | | | More generally, this permits a template to be specialized in any scope in which it could be defined, so this also supersedes DR44 and DR374 (the latter of which we previously only implemented in C++11 mode onwards due to unclarity as to whether it was a DR). llvm-svn: 327705
* DR259: Demote the pedantic error for an explicit instantiation after anRichard Smith2016-08-311-2/+2
| | | | | | | | | explicit specialization to a warning for C++98 mode (this is a defect report resolution, so per our informal policy it should apply in C++98), and turn the warning on by default for C++11 and later. In all cases where it fires, the right thing to do is to remove the pointless explicit instantiation. llvm-svn: 280308
* Add support for GCC's '__auto_type' extension, per the GCC manual:Richard Smith2015-11-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | https://gcc.gnu.org/onlinedocs/gcc/Typeof.html Differences from the GCC extension: * __auto_type is also permitted in C++ (but only in places where it could appear in C), allowing its use in headers that might be shared across C and C++, or used from C++98 * __auto_type can be combined with a declarator, as with C++ auto (for instance, "__auto_type *p") * multiple variables can be declared in a single __auto_type declaration, with the C++ semantics (the deduced type must be the same in each case) This patch also adds a missing restriction on applying typeof to a bit-field, which GCC has historically rejected in C (due to lack of clarity as to whether the operand should be promoted). The same restriction also applies to __auto_type in C (in both GCC and Clang). This also fixes PR25449. Patch by Nicholas Allegra! llvm-svn: 252690
* Improve the "braces around scalar init" warning to determine whether to warnRichard Smith2015-02-121-2/+2
| | | | | | | | based on whether "redundant" braces are ever reasonable as part of the initialization of the entity, rather than whether the initialization is "top-level". In passing, add a warning flag for it. llvm-svn: 228896
* Revert r218925 - "Patch to warn if 'override' is missing"Alexander Potapenko2014-10-031-3/+2
| | | | | | | | | | | | | | | | | | | | 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-2/+3
| | | | | | | | | | | | 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
* Change -Wbind-to-temporary-copy from an ExtWarn to an Extension.Nico Weber2014-09-181-26/+1
| | | | | | | | | | | | | | | | | The reasoning is that this construct is accepted by all compilers and valid in C++11, so it doesn't seem like a useful warning to have enabled by default. Building with -pedantic, -Wbind-to-temporary-copy, or -Wc++98-compat still shows the warning. The motivation is that I built re2, and this was the only warning that was emitted during the build. Both changing re2 to fix the warning and detecting clang and suppressing the warning in re2's build seem inferior than just giving the compiler a good default for this warning. Also move the cxx98compat version of this warning to CXX98CompatPedantic, and update tests accordingly. llvm-svn: 218008
* Reword switch/goto diagnostics "protected scope" diagnostics. Making up a termRichard Smith2014-09-061-4/+4
| | | | | | | | "protected scope" is very unhelpful here and actively confuses users. Instead, simply state the nature of the problem in the diagnostic: we cannot jump from here to there. The notes explain nicely why not. llvm-svn: 217293
* C++1y is now C++14!Aaron Ballman2014-08-191-16/+16
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Don't emit an ExtWarn on declarations of variable template specializations;Richard Smith2014-04-171-32/+4
| | | | | | | we'll already have issued the relevant diagnostic when we saw the declaration of the primary template. llvm-svn: 206441
* Implement DR329. We already did the right thing here in C++98 mode, but r104014Richard Smith2014-02-031-7/+0
| | | | | | (which implemented the DR) was disabled in C++11. llvm-svn: 200673
* Move away from 'general' / 'generalized' as a way of identifying C++11Richard Smith2014-01-171-1/+1
| | | | | | | | | | | | attribute syntax. There's nothing generalized about this; it's one of several first-class attribute syntaxes we support, all of which are more-or-less equally general. As discussed on cfe-commits, we may want to revisit this if we start allowing this syntax as an extension in C (or if C adopts the syntax), but hopefully this diagnostic wording will be crystal clear to everyone in the mean time. llvm-svn: 199443
* Clarify warn_cxx98_compat_attribute diagnosticAlp Toker2014-01-121-1/+1
| | | | | | | | Various attribute flavours are supported in C++98. Make it clear that this compatibility warning relates specifically to C++11-style generalized attributes. llvm-svn: 199053
* Use the appropriate SourceLocation for the template backtrace when doingNick Lewycky2014-01-111-2/+2
| | | | | | template argument deduction. llvm-svn: 198995
* Implement C++1y digit separator proposal (' as a digit separator). This is notRichard Smith2013-09-261-5/+4
| | | | | | yet approved by full committee, but was unanimously supported by EWG. llvm-svn: 191417
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-0/+77
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Undisable a test for a c++98-compat warning for inheriting constructors now ↵Richard Smith2013-07-201-5/+1
| | | | | | that we implement them. llvm-svn: 186768
* Fix handling of braced-init-list as reference initializer within aggregateRichard Smith2013-05-311-1/+1
| | | | | | | initialization. Previously we would incorrectly require an extra set of braces around such initializers. llvm-svn: 182983
* Revert r172285 (suppressing a 'redundant' -Wc++98-compat warning) and add aRichard Smith2013-01-261-0/+2
| | | | | | testcase for a situation it caused us to miss. llvm-svn: 173540
* Only produce one -Wc++98-compat warning when initializing a reference from ↵Richard Smith2013-01-121-0/+7
| | | | | | an init list with multiple elements. llvm-svn: 172285
* Properly compute triviality for explicitly-defaulted or deleted special members.Richard Smith2012-12-081-10/+10
| | | | | | | | | | | | | | Remove pre-standard restriction on explicitly-defaulted copy constructors with 'incorrect' parameter types, and instead just make those special members non-trivial as the standard requires. This required making CXXRecordDecl correctly handle classes which have both a trivial and a non-trivial special member of the same kind. This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the new triviality computation technology. llvm-svn: 169667
* Teach Clang parser to reject C++11 attributes that appertain to declaration ↵Michael Han2012-11-061-1/+1
| | | | | | | | | specifiers. We don't support any C++11 attributes that appertain to declaration specifiers so reject the attributes in parser until we support them; this also conforms to what g++ 4.8 is doing. llvm-svn: 167481
* The presence of a user-*declared* constructor makes the defaultDouglas Gregor2012-08-301-0/+11
| | | | | | | constructor not user provided (and, therefore, non-trivial). Fixes <rdar://problem/11736429>. llvm-svn: 162947
* Use the location of the copy assignment when diagnosing classes that are ↵Benjamin Kramer2012-07-301-0/+16
| | | | | | nontrivial because of it. llvm-svn: 160962
* Fix ambiguity detection in GetBestOverloadCandidateSimple.Benjamin Kramer2012-07-301-0/+11
| | | | | | | | | | When performing the simplistic overload resolution for single-argument methods, don't check the best overload for ambiguity with itself when the best overload doesn't happen to be the first one. Fixes PR13480. llvm-svn: 160961
* Remove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'Richard Smith2012-04-301-10/+0
| | | | | | | | | | being used in an exception specification in a way which isn't otherwise ill-formed in C++98: this warning also incorrectly triggered on uses of 'this' inside thread-safety attributes, and the mechanism required to tell these cases apart is more complex than can be justified by the (minimal) value of this part of -Wc++98-compat. llvm-svn: 155857
* PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.Richard Smith2012-04-271-1/+5
| | | | | | | We do not support IRGen for these, and get some parts of the semantic analysis wrong. llvm-svn: 155728
* Two missing -Wc++98-compat warnings, for null pointers as non-type templateRichard Smith2012-04-261-0/+18
| | | | | | arguments, and 'this' in exception-specifications. llvm-svn: 155606
* Add missing -Wc++98-compat warnings for initializer list initializations whichRichard Smith2012-04-191-1/+25
| | | | | | initialize references, create std::initializer_list objects, or call constructors. llvm-svn: 155105
* Implement C++11 [temp.arg.nontype]'s permission to use the address of an objectRichard Smith2012-04-041-0/+8
| | | | | | or function with internal linkage as a non-type template argument. llvm-svn: 154053
* PR10217: Provide diagnostics explaining why an implicitly-deleted specialRichard Smith2012-03-301-4/+2
| | | | | | member function is deleted. llvm-svn: 153773
* Fix the other place where C++98 work for initializer lists was necessary.Sebastian Redl2012-03-201-0/+4
| | | | llvm-svn: 153129
* Add the missing compatibility warning for braced initializers as default ↵Sebastian Redl2012-03-181-1/+2
| | | | | | arguments. llvm-svn: 153026
* Improve diagnostics for UCNs referring to control characters and members of theRichard Smith2012-03-091-0/+7
| | | | | | | | | | basic source character set in C++98. Add -Wc++98-compat diagnostics for same in literals in C++11. Extend such support to cover string literals as well as character literals, and mark N2170 as done. This seems too minor to warrant a release note to me. Let me know if you disagree. llvm-svn: 152444
* Lexing support for user-defined literals. Currently these lex as the same tokenRichard Smith2012-03-051-1/+1
| | | | | | | kinds as the underlying string literals, and we silently drop the ud-suffix; those issues will be fixed by subsequent patches. llvm-svn: 152012
* Tests for r151508.Richard Smith2012-02-261-0/+2
| | | | llvm-svn: 151509
* Fix r151443 to only apply C++11's exception for non-static data member accessRichard Smith2012-02-251-0/+11
| | | | | | | in cases where we would otherwise disallow the access, and add a -Wc++98-compat diagnostic for this C++11 feature. llvm-svn: 151444
* __decltype is a GNU extension, not a C++11 extension.Richard Smith2012-02-241-0/+1
| | | | llvm-svn: 151377
* C++11 allows unions to have static data members. Remove the correspondingRichard Smith2012-02-161-2/+6
| | | | | | restriction and add some tests. llvm-svn: 150721
* Proper initializer list support for new expressions and type construct ↵Sebastian Redl2012-02-121-1/+2
| | | | | | expressions. Array new still missing. llvm-svn: 150346
* Fix parsing new expressions using init lists. Probably still do the wrong ↵Sebastian Redl2012-02-111-1/+2
| | | | | | | | thing in cases involving array new. Show that many cases using initializer list constructors work, in that they parse and pass semantic analysis. llvm-svn: 150316
* Stub out the Sema interface for lambda expressions, and change the parser to ↵Eli Friedman2012-01-041-1/+2
| | | | | | use it. Unconditionally error on lambda expressions because they don't work in any meaningful way yet. llvm-svn: 147515
* Add -Wc++98-compat diagnostics for jumps which bypass initialization of non-PODRichard Smith2011-10-201-0/+17
| | | | | | | | but trivially constructible and destructible variables in C++11 mode. Also incidentally improve the precision of the wording for jump diagnostics in C++98 mode. llvm-svn: 142619
* Add -Wc++98-compat warning for enumerations in nested name specifiers.Richard Smith2011-10-201-0/+6
| | | | llvm-svn: 142568
* -Wc++98-compat: warn on nontrivial types used in unions and anonymous structs.Richard Smith2011-10-191-0/+24
| | | | llvm-svn: 142541
* -Wc++98-compat: diagnose if a reference is bound to a prvalue which does notRichard Smith2011-10-191-0/+27
| | | | | | have an unambiguous accessible copying constructor; this is ill-formed in C++98. llvm-svn: 142533
OpenPOWER on IntegriCloud