summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [MS] Consder constexpr globals to be inline, as in C++17Reid Kleckner2019-09-111-3/+3
| | | | | | | | | | | | | | | | Summary: Microsoft seems to do this regardless of the language mode, so we must also do it in order to be ABI compatible. Fixes PR36125 Reviewers: thakis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47956 llvm-svn: 371642
* [Sema] Actually map a variable template specialization from pattern to ↵Erik Pilkington2019-07-301-0/+29
| | | | | | | | | | | | | instantiation We were previously just using a specialization in the class template instead of creating a new specialization in the class instantiation. Fixes llvm.org/PR42779. Differential revision: https://reviews.llvm.org/D65359 llvm-svn: 367367
* Improve diagnostics and error recovery for template name lookup.Richard Smith2018-05-111-4/+4
| | | | | | | | | | | | | For 'x::template y', consistently give a "no member named 'y' in 'x'" diagnostic if there is no such member, and give a 'template keyword not followed by a template' name error if there is such a member but it's not a template. In the latter case, add a note pointing at the non-template. Don't suggest inserting a 'template' keyword in 'X::Y<' if X is dependent if the lookup of X::Y was actually not a dependent lookup and found only non-templates. llvm-svn: 332076
* Parse A::template B as an identifier rather than as a template-id with noRichard Smith2018-04-271-4/+4
| | | | | | | | | | template arguments. This fixes some cases where we'd incorrectly accept "A::template B" when B is a kind of template that requires template arguments (in particular, a variable template or a concept). llvm-svn: 331013
* Diagnose missing template arguments for a variable template even when there isRichard Smith2018-04-261-0/+16
| | | | | | | | | a preceding 'template' keyword. We only diagnose in the dependent case (wherein we used to crash). Another bug prevents the diagnostic from appearing in the non-template case. llvm-svn: 330894
* Factor out common code for diagnosing missing template arguments.Richard Smith2018-04-261-1/+0
| | | | | | In passing, add 'concept' to the list of template kinds in diagnostics. llvm-svn: 330890
* Implement C++ DR727, which permits explicit specializations at class scope.Richard Smith2018-03-161-4/+4
| | | | | | | | | 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
* Diagnose attempts to explicitly instantiate a template at class scope. ↵Richard Smith2017-02-091-4/+2
| | | | | | Previously Clang would simply ignore the 'template' keyword in this case. llvm-svn: 294639
* DR259: Demote the pedantic error for an explicit instantiation after anRichard Smith2016-08-311-4/+4
| | | | | | | | | 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
* Lit C++11 Compatibility Patch #8Charles Li2016-04-141-1/+1
| | | | | | 24 tests have been updated for C++11 compatibility. llvm-svn: 266387
* Fix PR24473 : Teach clang to remember to substitute into member variable ↵Faisal Vali2016-02-221-1/+45
| | | | | | | | templates referred to within dependent qualified ids. In passing also fix a semi-related bug that allows access to variable templates through member access notation. llvm-svn: 261506
* If a variable template is inside a context with template arguments that is ↵Nick Lewycky2015-08-101-0/+11
| | | | | | being instantiated, and that instantiation fails, fail our instantiation instead of crashing. Errors have already been emitted. llvm-svn: 244515
* [Sema] Emit a better diagnostic when variable redeclarations disagreeDavid Majnemer2015-07-141-2/+2
| | | | | | | | | | | We referred to all declaration in definitions in our diagnostic messages which is can be inaccurate. Instead, classify the declaration and emit an appropriate diagnostic for the new declaration and an appropriate note pointing to the old one. This fixes PR24116. llvm-svn: 242190
* Move fixit for const init from note to diag, weaken to warning in MS mode.Nico Weber2015-04-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r235046 turned "extern __declspec(selectany) int a;" from a declaration into a definition to fix PR23242 (required for compatibility with mc.exe output). However, this broke parsing Windows headers: A d3d11 headers contain something like struct SomeStruct {}; extern const __declspec(selectany) SomeStruct some_struct; This is now a definition, and const objects either need an explicit default ctor or an initializer so this errors out with d3d11.h(1065,48) : error: default initialization of an object of const type 'const CD3D11_DEFAULT' without a user-provided default constructor (cl.exe just doesn't implement this rule, independent of selectany.) To work around this, weaken this error into a warning for selectany decls in microsoft mode, and recover with zero-initialization. Doing this is a bit hairy since it adds a fixit on an error emitted by InitializationSequence – this means it needs to build a correct AST, which in turn means InitializationSequence::Failed() cannot return true when this fixit is applied. As a workaround, the patch adds a fixit member to InitializationSequence, and InitializationSequence::Perform() prints the diagnostic if the fixit member is set right after its call to Diagnose. That function is usually called when InitializationSequences are used – InitListChecker::PerformEmptyInit() doesn't call it, but the InitListChecker case never performs default-initialization, so this is technically OK. This is the alternative, original fix for PR20208 that got reviewed in the thread "[patch] Improve diagnostic on default-initializing const variables (PR20208)". This change basically reverts r213725, adds the original fix for PR20208, and makes the error a warning in Microsoft mode. llvm-svn: 235166
* Sema: Variable templates cannot be static bitfield membersDavid Majnemer2014-12-281-0/+6
| | | | | | | We correctly forbid variables but not variable templates. Diagnose this case instead of crashing. llvm-svn: 224905
* Improve diagnostic on default-initializing const variables (PR20208).Nico Weber2014-07-231-2/+2
| | | | | | | | This tweaks the diagnostic wording slighly, and adds a fixit on a note. An alternative would be to add the fixit directly on the diagnostic, see the review thread linked to from the bug for a few notes on that approach. llvm-svn: 213725
* Fix crash if a dependent template-id was assumed to be a type but instantiatesRichard Smith2013-12-041-0/+24
| | | | | | to a variable template specialization. llvm-svn: 196337
* Provide better diagnostic wording for initializers on staticHans Wennborg2013-11-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data member definitions when the variable has an initializer in its declaration. For the following code: struct S { static const int x = 42; }; const int S::x = 42; This patch changes the diagnostic from: a.cc:4:14: error: redefinition of 'x' const int S::x = 42; ^ a.cc:2:20: note: previous definition is here static const int x = 42; ^ to: a.cc:4:18: error: static data member 'x' already has an initializer const int S::x = 42; ^ a.cc:2:24: note: previous initialization is here static const int x = 42; ^ Differential Revision: http://llvm-reviews.chandlerc.com/D2235 llvm-svn: 195306
* Variable templates: handle instantiation of static data member templatesRichard Smith2013-09-271-68/+108
| | | | | | appropriately, especially when they appear within class templates. llvm-svn: 191548
* Implement restriction that a partial specialization must actually specializeRichard Smith2013-09-241-18/+19
| | | | | | something, for variable templates. llvm-svn: 191278
* Remove a bogus diagnostic preventing static data member templates from beingRichard Smith2013-09-181-6/+5
| | | | | | defined with no initializer. llvm-svn: 190970
* If a variable template specialization with an incomplete array type isRichard Smith2013-09-181-3/+33
| | | | | | referenced, try to instantiate its definition in order to complete the type. llvm-svn: 190910
* Add a constexpr functionality test for static data member templates.Larisse Voufo2013-08-221-0/+19
| | | | llvm-svn: 188975
* Refactor for clarity and simplicity.Larisse Voufo2013-08-221-55/+57
| | | | llvm-svn: 188974
* Improve support for static data member templates. This revision still has at ↵Larisse Voufo2013-08-221-8/+57
| | | | | | least one bug, as it does not respect the variable template specialization hierarchy well. llvm-svn: 188969
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-0/+159
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
OpenPOWER on IntegriCloud