Hi rsmith,

Hi,
Review request on phabricator for patch discussed at 
http://permalink.gmane.org/gmane.comp.compilers.clang.scm/84487
for easier review.

Implemented review comments from Richard.
Please let me know if it looks good to commit.
Thanks.

http://llvm-reviews.chandlerc.com/D2049

Files:
  test/CXX/drs/dr2xx.cpp
  lib/AST/Expr.cpp

Index: test/CXX/drs/dr2xx.cpp
===================================================================
--- test/CXX/drs/dr2xx.cpp
+++ test/CXX/drs/dr2xx.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions
+// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions
+// expected-no-diagnostics
+
+// Test that a specialization can have a different size.
+
+template <int> void g();
+template <> void g<2>() { }
+
+template <typename T>
+struct S {
+  static int i[];
+  void f();
+};
+
+template <typename T>
+int S<T>::i[] = { 1 };
+
+template <typename T>
+void S<T>::f() {
+  g<sizeof (i) / sizeof (int)>();
+}
+
+template <>
+int S<int>::i[] = { 1, 2 };
+
+void test() {
+  S<int> s;
+  s.f(); // Triggers void g<2>()
+}
Index: lib/AST/Expr.cpp
===================================================================
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -314,6 +314,9 @@
         Var->getDeclContext()->isDependentContext()) {
       ValueDependent = true;
       InstantiationDependent = true;
+      TypeSourceInfo *TInfo = Var->getTypeSourceInfo();
+      if (TInfo->getType()->isIncompleteArrayType())
+        TypeDependent = true;
     }
     
     return;
Index: test/CXX/drs/dr2xx.cpp
===================================================================
--- test/CXX/drs/dr2xx.cpp
+++ test/CXX/drs/dr2xx.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions
+// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions
+// expected-no-diagnostics
+
+// Test that a specialization can have a different size.
+
+template <int> void g();
+template <> void g<2>() { }
+
+template <typename T>
+struct S {
+  static int i[];
+  void f();
+};
+
+template <typename T>
+int S<T>::i[] = { 1 };
+
+template <typename T>
+void S<T>::f() {
+  g<sizeof (i) / sizeof (int)>();
+}
+
+template <>
+int S<int>::i[] = { 1, 2 };
+
+void test() {
+  S<int> s;
+  s.f(); // Triggers void g<2>()
+}
Index: lib/AST/Expr.cpp
===================================================================
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -314,6 +314,9 @@
         Var->getDeclContext()->isDependentContext()) {
       ValueDependent = true;
       InstantiationDependent = true;
+      TypeSourceInfo *TInfo = Var->getTypeSourceInfo();
+      if (TInfo->getType()->isIncompleteArrayType())
+        TypeDependent = true;
     }
     
     return;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to