[PATCH] D29271: Revert r293455, which breaks v8 with a spurious error. Testcase added.

2017-01-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

In https://reviews.llvm.org/D29271#660169, @sberg wrote:

> Btw, ran into that with the even simpler test case


Thanks, I stole it :-)


https://reviews.llvm.org/D29271



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29271: Revert r293455, which breaks v8 with a spurious error. Testcase added.

2017-01-30 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL293473: Revert r293455, which breaks v8 with a spurious 
error. Testcase added. (authored by sammccall).

Changed prior to commit:
  https://reviews.llvm.org/D29271?vs=86257&id=86259#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29271

Files:
  cfe/trunk/include/clang/AST/DeclTemplate.h
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/lib/Sema/SemaTemplate.cpp
  cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
  cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
  cfe/trunk/lib/Sema/TreeTransform.h
  cfe/trunk/test/Parser/cxx1z-class-template-argument-deduction.cpp
  cfe/trunk/test/SemaCXX/cxx0x-class.cpp

Index: cfe/trunk/include/clang/AST/DeclTemplate.h
===
--- cfe/trunk/include/clang/AST/DeclTemplate.h
+++ cfe/trunk/include/clang/AST/DeclTemplate.h
@@ -2946,16 +2946,6 @@
   return P.get();
 }
 
-inline TemplateDecl *getAsTypeTemplateDecl(Decl *D) {
-  auto *TD = dyn_cast(D);
-  return TD && (isa(TD) ||
-isa(TD) ||
-isa(TD) ||
-isa(TD))
- ? TD
- : nullptr;
-}
-
 } /* end of namespace clang */
 
 #endif
Index: cfe/trunk/include/clang/Sema/Sema.h
===
--- cfe/trunk/include/clang/Sema/Sema.h
+++ cfe/trunk/include/clang/Sema/Sema.h
@@ -7359,8 +7359,7 @@
 
   TypeSourceInfo *SubstType(TypeSourceInfo *T,
 const MultiLevelTemplateArgumentList &TemplateArgs,
-SourceLocation Loc, DeclarationName Entity,
-bool AllowDeducedTST = false);
+SourceLocation Loc, DeclarationName Entity);
 
   QualType SubstType(QualType T,
  const MultiLevelTemplateArgumentList &TemplateArgs,
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1884,11 +1884,6 @@
   "|in conversion function type|here|in lambda parameter"
   "|in type allocated by 'new'|in K&R-style function parameter"
   "|in template parameter|in friend declaration}1">;
-def err_dependent_deduced_tst : Error<
-  "typename specifier refers to "
-  "%select{class template|function template|variable template|alias template|"
-  "template template parameter|template}0 member in %1; "
-  "argument deduction not allowed here">;
 def err_auto_not_allowed_var_inst : Error<
   "'auto' variable template instantiation is not allowed">;
 def err_auto_var_requires_init : Error<
Index: cfe/trunk/test/Parser/cxx1z-class-template-argument-deduction.cpp
===
--- cfe/trunk/test/Parser/cxx1z-class-template-argument-deduction.cpp
+++ cfe/trunk/test/Parser/cxx1z-class-template-argument-deduction.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -verify %s
 
-template struct A {}; // expected-note 35{{declared here}}
+template struct A {}; // expected-note 31{{declared here}}
 
 // Make sure we still correctly parse cases where a template can appear without arguments.
 namespace template_template_arg {
@@ -101,8 +101,6 @@
 (void)reinterpret_cast(&n); // expected-error{{requires template arguments; argument deduction not allowed here}}
 (void)const_cast(n); // expected-error{{requires template arguments; argument deduction not allowed here}}
 (void)*(A*)(&n); // expected-error{{requires template arguments; argument deduction not allowed here}}
-(void)(A)(n); // expected-error{{requires template arguments; argument deduction not allowed here}}
-(void)(A){n}; // expected-error{{requires template arguments; argument deduction not allowed here}}
 
 (void)A(n); // expected-error {{not yet supported}}
 (void)A{n}; // expected-error {{not yet supported}}
@@ -123,66 +121,11 @@
 
   A a; // expected-error {{requires an initializer}}
   A b = 0; // expected-error {{not yet supported}}
-  const A c = 0; // expected-error {{not yet supported}}
   A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}}
   A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
   A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}}
   A arr[3] = 0; // expected-error {{cannot form array of deduced class template specialization type}}
   A F::*pm = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
   A (*fp)() = 0; // expected-error {{cannot form function returning deduced class template specialization type}}
   A

[PATCH] D29271: Revert r293455, which breaks v8 with a spurious error. Testcase added.

2017-01-30 Thread Manuel Klimek via Phabricator via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D29271



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29271: Revert r293455, which breaks v8 with a spurious error. Testcase added.

2017-01-30 Thread Stephan Bergmann via Phabricator via cfe-commits
sberg added a comment.

Btw, ran into that with the even simpler test case

  template struct S {
  static typename T::t const n = 0;
  };
  struct U { using t = int; };
  int main() { return S::n; }


https://reviews.llvm.org/D29271



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29271: Revert r293455, which breaks v8 with a spurious error. Testcase added.

2017-01-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.

Revert r293455, which breaks v8 with a spurious error. Testcase added.


https://reviews.llvm.org/D29271

Files:
  include/clang/AST/DeclTemplate.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateInstantiate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Sema/TreeTransform.h
  test/Parser/cxx1z-class-template-argument-deduction.cpp
  test/SemaCXX/cxx0x-class.cpp

Index: test/SemaCXX/cxx0x-class.cpp
===
--- test/SemaCXX/cxx0x-class.cpp
+++ test/SemaCXX/cxx0x-class.cpp
@@ -45,3 +45,12 @@
   DefaultMemberTemplate t = {};
   int *p = &t.n;
 };
+
+namespace composed_templates {
+  // Regression test -- obtaining the type from composed templates should not
+  // require out-of-line definition.
+  template  struct Foo { static constexpr bool value = true; };
+  template  struct Bar { using type = char; };
+  template  struct Baz { static const typename Bar::value>::type value = 0; };
+  template struct Baz<0>;
+}
Index: test/Parser/cxx1z-class-template-argument-deduction.cpp
===
--- test/Parser/cxx1z-class-template-argument-deduction.cpp
+++ test/Parser/cxx1z-class-template-argument-deduction.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -verify %s
 
-template struct A {}; // expected-note 35{{declared here}}
+template struct A {}; // expected-note 31{{declared here}}
 
 // Make sure we still correctly parse cases where a template can appear without arguments.
 namespace template_template_arg {
@@ -101,8 +101,6 @@
 (void)reinterpret_cast(&n); // expected-error{{requires template arguments; argument deduction not allowed here}}
 (void)const_cast(n); // expected-error{{requires template arguments; argument deduction not allowed here}}
 (void)*(A*)(&n); // expected-error{{requires template arguments; argument deduction not allowed here}}
-(void)(A)(n); // expected-error{{requires template arguments; argument deduction not allowed here}}
-(void)(A){n}; // expected-error{{requires template arguments; argument deduction not allowed here}}
 
 (void)A(n); // expected-error {{not yet supported}}
 (void)A{n}; // expected-error {{not yet supported}}
@@ -123,66 +121,11 @@
 
   A a; // expected-error {{requires an initializer}}
   A b = 0; // expected-error {{not yet supported}}
-  const A c = 0; // expected-error {{not yet supported}}
   A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}}
   A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
   A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}}
   A arr[3] = 0; // expected-error {{cannot form array of deduced class template specialization type}}
   A F::*pm = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
   A (*fp)() = 0; // expected-error {{cannot form function returning deduced class template specialization type}}
   A [x, y] = 0; // expected-error {{cannot be declared with type 'A'}} expected-error {{not yet supported}}
 }
-
-namespace typename_specifier {
-  struct F {};
-
-  void e() {
-(void) typename ::A(0); // expected-error {{not yet supported}}
-(void) typename ::A{0}; // expected-error {{not yet supported}}
-new typename ::A(0); // expected-error {{not yet supported}}
-new typename ::A{0}; // expected-error {{not yet supported}}
-typename ::A a = 0; // expected-error {{not yet supported}}
-const typename ::A b = 0; // expected-error {{not yet supported}}
-if (typename ::A a = 0) {} // expected-error {{not yet supported}}
-for (typename ::A a = 0; typename ::A b = 0; /**/) {} // expected-error 2{{not yet supported}}
-
-(void)(typename ::A)(0); // expected-error{{requires template arguments; argument deduction not allowed here}}
-(void)(typename ::A){0}; // expected-error{{requires template arguments; argument deduction not allowed here}}
-  }
-  typename ::A a = 0; // expected-error {{not yet supported}}
-  const typename ::A b = 0; // expected-error {{not yet supported}}
-  typename ::A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}}
-  typename ::A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
-  typename ::A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}}
-  typename ::A arr[3] = 0; // expected-error {{cannot form array of deduced class template specialization type}}
-  typename ::A F::*pm = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
-  typename ::A (*fp)() = 0; //