This revision was automatically updated to reflect the committed changes.
Closed by commit rC328409: [C++17] Fix class template argument deduction for
default constructors without… (authored by lichray, committed by ).
Repository:
rC Clang
https://reviews.llvm.org/D38216
Files:
rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.
Comment at: test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp:17
};
extern A x; // expected-error {{requires an initializer}}
+static A y;
Rakete updated this revision to Diff 138862.
Rakete added a comment.
@lichray Ok done :) Thanks for reviewing
https://reviews.llvm.org/D38216
Files:
lib/Sema/SemaDecl.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
lichray added a comment.
LGTM
Comment at: test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp:17
};
extern A x; // expected-error {{requires an initializer}}
Please add one more test to the end of the file saying
```
static A y;
```
as a
Rakete updated this revision to Diff 138187.
Rakete added a comment.
Addressed review comments :)
Thanks!
https://reviews.llvm.org/D38216
Files:
lib/Sema/SemaDecl.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
rsmith requested changes to this revision.
rsmith added a comment.
This revision now requires changes to proceed.
Per [dcl.type.class.deduct]p1, only the initializing declaration of a variable
can use a placeholder type. The existing diagnostic was correct in many of the
modified cases.
Rakete updated this revision to Diff 128662.
Rakete marked an inline comment as done.
Rakete added a comment.
Rebased + friendly 2018 ping
https://reviews.llvm.org/D38216
Files:
lib/Sema/SemaDecl.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
rsmith added a comment.
In https://reviews.llvm.org/D38216#924039, @lichray wrote:
> So gcc got this wrong?
>
> https://wandbox.org/permlink/RVApvaca1ebUfInn
Yes, the declaration `extern A a;` in that example is ill-formed.
https://reviews.llvm.org/D38216
lichray added a comment.
In https://reviews.llvm.org/D38216#923580, @rsmith wrote:
> That's almost right, but not all `extern` declarations are disallowed. (An
> `extern` declaration is still a defining declaration if it has an
> initializer.)
Good to know, thanks.
So gcc got this wrong?
Rakete updated this revision to Diff 122708.
Rakete added a comment.
Made `DeduceInits` empty instead of a workaround somewhere else. Is it still
ok, @rsmith ?
https://reviews.llvm.org/D38216
Files:
lib/Sema/SemaDecl.cpp
rsmith added a comment.
In https://reviews.llvm.org/D38216#922768, @lichray wrote:
> So deducing from default initialization is indeed allowed, but `extern`
> could be interpreted as outlawed because similar to the case of non-
> inline static data member, where the declaration doesn't give
lichray added a comment.
In https://reviews.llvm.org/D38216#922709, @Rakete wrote:
> @lichray Isn't [dcl.type.auto.deduct] only for `auto` and `decltype(auto)`?
Sorry, reasoned on a confusingly similar part... Here is
updated information:
> 10.1.7.5 [dcl.type.class.deduct]
> If a
Rakete added a comment.
@lichray Isn't [dcl.type.auto.deduct] only for `auto` and `decltype(auto)`?
Class template argument deduction is in [dcl.type.class.deduct], which doesn't
seem to disallow declarations without an initializer.
About that `extern` business, yes that's indeed counter
lichray added a comment.
The standard hasn't allowed deducing any placeholder type without an
initializer (10.1.7.4.1 [dcl.type.auto.deduct]/2) yet.
It's unclear to me what
extern A x;
wants to archive. Usually when people writing `extern` then expect an
initializer to appear somewhere
Rakete updated this revision to Diff 122576.
Rakete added a comment.
Slight change + rebased + friendly ping :)
https://reviews.llvm.org/D38216
Files:
lib/Sema/SemaDecl.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
Rakete updated this revision to Diff 119035.
Rakete added a comment.
Rebased and friendly ping :)
https://reviews.llvm.org/D38216
Files:
lib/Sema/SemaDecl.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp
test/Parser/cxx1z-class-template-argument-deduction.cpp
Rakete created this revision.
Rakete added a project: clang.
As the title says, this makes following code compile:
template struct Foo {};
Foo() -> Foo;
Foo f; // ok
https://reviews.llvm.org/D38216
Files:
lib/Sema/SemaDecl.cpp
17 matches
Mail list logo