http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48500
Summary: Regression: Failing to convert template argument to concrete type, in C++0x mode. Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: jyass...@gcc.gnu.org CC: ja...@gcc.gnu.org This shows up in template functions that try to pass a value whose type is a template argument to a function that expects one or more concrete types. The code compiles in gcc-4.5, produces an error in 4.6.0 and gcc-4_6-branch, and produces an ICE in trunk. All of them succeed in C++98 mode. $ cat test.cc struct linked_ptr { }; template <typename T> linked_ptr make_linked_ptr(T* ptr); struct Concrete; struct NewedClass { NewedClass(const Concrete& req){} }; template<typename ArgT> void AddObjToChange(const ArgT& req) { linked_ptr p = make_linked_ptr(new NewedClass(req)); } $ g++-mp-4.5 -c test.cc -std=gnu++0x $ g++-mp-4.6 -c test.cc -std=gnu++0x # Or gcc-4_6-branch at r172074 test.cc: In function 'void AddObjToChange(const ArgT&)': test.cc:9:53: error: no matching function for call to 'NewedClass::NewedClass(const ArgT&)' test.cc:9:53: note: candidates are: test.cc:6:3: note: NewedClass::NewedClass(const Concrete&) test.cc:6:3: note: no known conversion for argument 1 from 'const ArgT' to 'const Concrete&' test.cc:5:8: note: constexpr NewedClass::NewedClass(const NewedClass&) test.cc:5:8: note: no known conversion for argument 1 from 'const ArgT' to 'const NewedClass&' test.cc:5:8: note: constexpr NewedClass::NewedClass(NewedClass&&) test.cc:5:8: note: no known conversion for argument 1 from 'const ArgT' to 'NewedClass&&' $ trunk-r172073/g++ -std=gnu++0x -c test.cc test.cc: In function ‘void AddObjToChange(const ArgT&)’: test.cc:9:53: internal compiler error: tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_base, at cp/search.c:212 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ An error in similar code went away with the fix to PR48319.