Commit 350562a7 by Jason Merrill Committed by Jason Merrill

re PR c++/65719 (Link error with constexpr variable template)

	PR c++/65719
	* pt.c (tsubst_decl) [VAR_DECL]: Mark namespace-scope
	variables as DECL_NOT_REALLY_EXTERN.

From-SVN: r224442
parent df649a1c
2015-06-12 Jason Merrill <jason@redhat.com>
PR c++/65719
* pt.c (tsubst_decl) [VAR_DECL]: Mark namespace-scope
variables as DECL_NOT_REALLY_EXTERN.
2015-06-11 Jason Merrill <jason@redhat.com>
PR c++/66445
......
......@@ -11306,8 +11306,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
{
/* T is a static data member or namespace-scope entity.
We have to substitute into namespace-scope variables
(even though such entities are never templates) because
of cases like:
(not just variable templates) because of cases like:
template <class T> void f() { extern T t; }
......@@ -11468,6 +11467,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
initializer is present. We mimic the non-template
processing here. */
DECL_EXTERNAL (r) = 1;
if (DECL_NAMESPACE_SCOPE_P (t))
DECL_NOT_REALLY_EXTERN (r) = 1;
DECL_TEMPLATE_INFO (r) = build_template_info (tmpl, argvec);
SET_DECL_IMPLICIT_INSTANTIATION (r);
......
// PR c++/65719
// { dg-do link { target c++14 } }
struct FunctionObject {
void operator()() const { }
};
template <typename T>
constexpr FunctionObject f{};
int main() {
f<int>();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment