diff --git a/README/ReleaseNotes/v638/index.md b/README/ReleaseNotes/v638/index.md index 273c5c24b88b3..9e67385c49910 100644 --- a/README/ReleaseNotes/v638/index.md +++ b/README/ReleaseNotes/v638/index.md @@ -4,6 +4,9 @@ * The `RooStats::HLFactory` class that was deprecated in ROOT 6.36 is now removed. It provided little advantage over using the RooWorkspace directly or any of the other higher-level frameworks that exist in the RooFit ecosystem. * The build options `mysql`, `odbc` and `pgsql`, that were deprecated in ROOT 6.36, are now removed. +## Core Libraries +* Behavior change: when selecting a template instantiation for a dictionary, all the template arguments have to be fully defined - the forward declarations are not enough any more. The error prompted by the dictionary generator will be `Warning: Unused class rule: MyTemplate`. + ## Math ### Minuit2 diff --git a/core/dictgen/src/BaseSelectionRule.cxx b/core/dictgen/src/BaseSelectionRule.cxx index 3abed7a1d6c04..9f3ad3a27ca9e 100644 --- a/core/dictgen/src/BaseSelectionRule.cxx +++ b/core/dictgen/src/BaseSelectionRule.cxx @@ -225,7 +225,7 @@ BaseSelectionRule::EMatchType BaseSelectionRule::Match(const clang::NamedDecl *d return kName; } } else if (fHasNameAttribute) { - if (name_value == name) { + if (name_value == name && !decl->isInvalidDecl()) { const_cast(this)->SetMatchFound(true); return kName; } else if (fCXXRecordDecl == nullptr || @@ -236,7 +236,7 @@ BaseSelectionRule::EMatchType BaseSelectionRule::Match(const clang::NamedDecl *d = fHasFromTypedefAttribute ? nullptr : ROOT::TMetaUtils::ScopeSearch(name_value.c_str(), *fInterp, true /*diagnose*/, nullptr); - if ( target ) { + if ( target && !target->isInvalidDecl()) { const_cast(this)->fCXXRecordDecl = target; } else { // If the lookup failed, let's not try it again, so mark the value has invalid. diff --git a/interpreter/cling/lib/Interpreter/LookupHelper.cpp b/interpreter/cling/lib/Interpreter/LookupHelper.cpp index 79904b65819a6..5761c0bcd325c 100644 --- a/interpreter/cling/lib/Interpreter/LookupHelper.cpp +++ b/interpreter/cling/lib/Interpreter/LookupHelper.cpp @@ -698,13 +698,6 @@ namespace cling { TagDecl* TD = TagTy->getDecl(); if (TD) { TheDecl = TD->getDefinition(); - // NOTE: if (TheDecl) ... check for theDecl->isInvalidDecl() - if (TD && TD->isInvalidDecl()) { - printf("Warning: FindScope got an invalid tag decl\n"); - } - if (TheDecl && TheDecl->isInvalidDecl()) { - printf("ERROR: FindScope about to return an invalid decl\n"); - } if (!TheDecl && instantiateTemplate) { // Make sure it is not just forward declared, and diff --git a/roottest/root/meta/rootcling/CMakeLists.txt b/roottest/root/meta/rootcling/CMakeLists.txt index e60c8c0638d3f..3c79434a9430e 100644 --- a/roottest/root/meta/rootcling/CMakeLists.txt +++ b/roottest/root/meta/rootcling/CMakeLists.txt @@ -32,4 +32,9 @@ ROOTTEST_ADD_TEST(ROOT10798 ROOTTEST_GENERATE_DICTIONARY(streamerInfoStdFunctionDict streamerInfoStdFunction.h LINKDEF streamerInfoStdFunction.xml) ROOTTEST_ADD_TEST(streamerInfoStdFunction MACRO streamerInfoStdFunction.C - DEPENDS ${GENERATE_DICTIONARY_TEST}) \ No newline at end of file + DEPENDS ${GENERATE_DICTIONARY_TEST}) + +# Issue #18982 +ROOTTEST_ADD_TEST(selectTemplateInvalidArg + COMMAND ${ROOT_rootcling_CMD} -f selectTemplateInvalidArg.Dict.cc ${CMAKE_CURRENT_SOURCE_DIR}/selectTemplateInvalidArg.h ${CMAKE_CURRENT_SOURCE_DIR}/selectTemplateInvalidArg.LinkDef.h + ERRREF selectTemplateInvalidArg.ref) diff --git a/roottest/root/meta/rootcling/selectTemplateInvalidArg.LinkDef.h b/roottest/root/meta/rootcling/selectTemplateInvalidArg.LinkDef.h new file mode 100644 index 0000000000000..d804102fc8ce2 --- /dev/null +++ b/roottest/root/meta/rootcling/selectTemplateInvalidArg.LinkDef.h @@ -0,0 +1,9 @@ +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class RtObj2+; + +#endif diff --git a/roottest/root/meta/rootcling/selectTemplateInvalidArg.h b/roottest/root/meta/rootcling/selectTemplateInvalidArg.h new file mode 100644 index 0000000000000..572085caaf71a --- /dev/null +++ b/roottest/root/meta/rootcling/selectTemplateInvalidArg.h @@ -0,0 +1,14 @@ +#include + +template +class RtObj2 : public T + { + public: + RtObj2() {} + RtObj2( const T & val ) : T(val) {} + ClassDefT(RtObj2,1) + } ; + +ClassDefT2(RtObj2,T) + +ClassImpT(RtObj2,T) diff --git a/roottest/root/meta/rootcling/selectTemplateInvalidArg.ref b/roottest/root/meta/rootcling/selectTemplateInvalidArg.ref new file mode 100644 index 0000000000000..9e98c1f24d406 --- /dev/null +++ b/roottest/root/meta/rootcling/selectTemplateInvalidArg.ref @@ -0,0 +1 @@ +Warning: Unused class rule: RtObj2