In case of template instantiations query the template instantiation pattern,
which had actually '=default'.
Fixes https://llvm.org/bugs/show_bug.cgi?id=27739
Patch reviewed by Richard Smith.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270553
91177308-0d34-0410-b5e6-
96231b3b80d8
// the record is complete.
const FunctionDecl *Primary = MD;
if (const FunctionDecl *Pattern = MD->getTemplateInstantiationPattern())
- // Find the uninstantiated declaration that actually had the '= default'
- // on it.
- Pattern->isDefined(Primary);
+ // Ask the template instantiation pattern that actually had the
+ // '= default' on it.
+ Primary = Pattern;
// If the method was defaulted on its first declaration, we will have
// already performed the checking in CheckCompletedCXXClass. Such a
// declaration doesn't trigger an implicit definition.
- if (Primary == Primary->getCanonicalDecl())
+ if (Primary->getCanonicalDecl()->isDefaulted())
return;
CheckExplicitlyDefaultedSpecialMember(MD);
--- /dev/null
+template < typename > struct vector {};
+
+#include <map>
+#include "Types.h"
+
+struct TString {
+ TString (char *);
+};
+
+struct TreeInfo {};
+
+class DataInputHandler {
+ void AddTree ();
+ void SignalTreeInfo () {
+ fInputTrees[(char*)""];
+ }
+ map <TString, vector <TreeInfo> >fInputTrees;
+ map <string, bool> fExplicitTrainTest;
+};
--- /dev/null
+#include <map>
--- /dev/null
+#ifndef _GLIBCXX_MAP
+#define _GLIBCXX_MAP
+struct basic_string {
+ basic_string(char *);
+} typedef string;
+
+template <typename> class D;
+template <typename _Elements> struct D {
+ _Elements _M_;
+ D(D &) = default;
+};
+
+template <typename _Elements> D<_Elements &&> forward_as_tuple(_Elements);
+
+template <typename _Key, typename _Tp> struct map {
+ _Tp operator[](_Key p1) {
+ auto b = &forward_as_tuple(p1);
+ }
+};
+#endif
--- /dev/null
+module "DataInputHandler.h" { header "DataInputHandler.h" export * }
+module "Types.h" { header "Types.h" export *}
--- /dev/null
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -internal-externc-isystem %S/Inputs/PR27739 -verify %s
+// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR27739/module.modulemap -fmodules-cache-path=%t -internal-externc-isystem %S/Inputs/PR27739/ -verify %s
+
+#include "DataInputHandler.h"
+
+void DataInputHandler::AddTree() {
+ fInputTrees[(char*)""];
+ fExplicitTrainTest[(char*)""];
+}
+
+// expected-no-diagnostics